Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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.


Comment on Re: Going through a big file [solved]
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (11)
As of 2014-09-17 18:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (94 votes), past polls