Search results for "module:Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop"

Perl::Critic::Policy::InputOutput::ProhibitReadlineInForLoop - Write < while( $line = < ){...} >> instead of < for(<){...} >>. River stage three • 131 direct dependents • 386 total dependents

Using the readline operator in a "for" or "foreach" loop is very slow. The iteration list of the loop creates a list context, which causes the readline operator to read the entire input stream before iteration even starts. Instead, just use a "while"...

PETDANCE/Perl-Critic-1.142 - 29 Nov 2022 02:20:23 UTC
1 result (0.073 seconds)