2 ms·
I'm not sure if it's still the case (I recall some discussion about optimising it) but using the more obvious[1] idiom of foreach my $line (<$FH>) { ... }
by shabble 13y ago
I'm not sure if it's still the case (I recall some discussion about optimising it) but using the more obvious[1] idiom of
foreach my $line (<$FH>) { ... }
slurps the entire file because the foreach is forcing list context on the diamond operator.
The
while(<$FH>) { ... }
that you describe works as desired though.
http://stackoverflow.com/questions/585341/ http://stackoverflow.com/questions/585341/ appears to cover it in some detail.
[1] To me, anyway.