Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Reading from a file

by thinker (Parson)
on Aug 26, 2003 at 09:56 UTC ( [id://286640]=note: print w/replies, xml ) Need Help??


in reply to Reading from a file

Hi itzMe,

If you want to be able to access the contents of the file again after initially reading it, slurp it into an array. This is as simple as

open FILE, "sample.txt" or die $!; my @lines = <file1>;

Now you can use @lines in whatever way you want.

Hope this helps

thinker

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-09-07 20:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.