Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Going through a big file [solved]

by space_monk (Chaplain)
on Jan 17, 2013 at 16:15 UTC ( #1013809=note: print w/replies, xml ) Need Help??

in reply to Going through a big file [solved]

lanX's comment at Re: Going through a big file excellently explains the difference between how for slurps the whole lot into an array, but while does it line by line. The only comment I would add is why bother to have it open the files manually when it can be done implicitly?
while (<>) { }
does the job. Arguments other than the file(s) you want to process should be flags. In fact, you don't even need to write this code as it is automatically assumed when you run perl with flags such as -n or -p. See perlrun for more information.
A Monk aims to give answers to those who have none, and to learn from those who know more.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013809]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2019-10-14 02:59 GMT
Find Nodes?
    Voting Booth?