Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Read from a file one line at a time?

by bitingduck (Chaplain)
on Feb 20, 2012 at 17:29 UTC ( #955111=note: print w/replies, xml ) Need Help??


in reply to Read from a file one line at a time?

Assuming you've already opened the filehandle FILE you can read all the lines into a list with

my @lines=<File>;

or read one line at a time with

while (<FILE>){ my $line=$_; }

there are more compact ways to do the latter, as well.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://955111]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2017-06-25 05:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (564 votes). Check out past polls.