Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
The stupid question is the question not asked
 
PerlMonks  

Re: how do I open each line of a text file into seperate arrays?

by Sifmole (Chaplain)
on May 01, 2001 at 13:47 UTC ( [id://76956]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to how do I open each line of a text file into seperate arrays?

And just one more way...
open(IN, "<foo.txt"); # This line does the work. # <IN> reads lines from the file, feeding that list to the map. # split(/\|/, $_) creates a list of the the pipe-delimted elements # [ ] creates an anonymous array ref to that list. # Finally the map returns the resulting list of array refs. my @foo = map { [(split(/\|/, $_))] } <IN>; close(IN); # Just to prove that it worked. foreach (@foo) { print join(' -- ', @$_), "\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://76956]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.