Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How can I define arrays using foreach loop

by Juerd (Abbot)
on Jul 17, 2002 at 08:51 UTC ( [id://182358]=note: print w/replies, xml ) Need Help??


in reply to How can I define arrays using foreach loop

my @thearray = (1, 4, 6); my @columns = split ' ', <INFILE>; my @arrays = \(@array_1, @array_2, @array_3, @array_4, @array_5, @arra +y_6); for (@foo) { push @{ $arrays[$_] }, [ $line, $columns[$_] ]; }
"thearray", "bigarray" and "array_1" are bad names. Think of better ones!

And use an array of arrays, not symbols that have an index in their name. See perllol, perlreftut, perlref.

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-04-19 20:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found