Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Reading from a file

by thinker (Parson)
on Aug 26, 2003 at 09:56 UTC ( #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
Node Status?
node history
Node Type: note [id://286640]
help
Chatterbox?
[Eily]: hello people \o/
[karlgoethebier]: manpages..
[Eily]: and non-people and NodeReaper
[Discipulus]: you so kid to greet non people..;=)
Discipulus kind not kid..
[Corion]: The bots bow in response
[Discipulus]: so karlgoethebier, what this idiom is and where i can read about it? i tried to deparse and gives error..;=(
[karlgoethebier]: Eily: non-people == persone non grata?
[Your Mother]: Corion: I have lost the link to the pmdev guide(s). Do you have that handy?
[karlgoethebier]: Discipulus: see per lop please how to avoid the classic <c>perl dangerous.pl 'rm -rfv *|'</>

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2017-07-21 08:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (319 votes). Check out past polls.