|Perl Monk, Perl Meditation|
Re: Going through a big fileby LanX (Chancellor)
|on Jan 17, 2013 at 12:37 UTC||Need Help??|
> First I tried the obvious
You will hardly find any example in the perldocs ever trying this.
your code is semantically equivalent to
slurping the whole file as a first step.
for expects a list and evaluates in list context╣, so it's greedily swallowing all at once.
But while iterates in scalar context, that is line by line (as defined by '$/')
╣) with a little magical exception in recent Perl versions (>= 5.8 ?) regarding ranges, which isn't relevant here