Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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

by bitingduck (Hermit)
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.


Comment on Re: Read from a file one line at a time?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (12)
As of 2015-05-27 16:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (540 votes), past polls