Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

(Ovid) RE(3): Parsing a file one line at a time

by Ovid (Cardinal)
on Jul 23, 2000 at 21:17 UTC ( [id://23989]=note: print w/replies, xml ) Need Help??


in reply to RE: RE: Parsing a file one line at a time
in thread Parsing a file one line at a time

Actually, "slurp" mode is used for reading the contents of a file into a scalar. You're using an array. If you assign a filehandle to an array, Perl just "understands" and reads the entire file into the array. This code works fine:
open(FILE1, $ARGV[0]) || die "Error: $!\n"; @lines = <FILE1>;
Cheers,
Ovid

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-23 23:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found