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.


In reply to Re: How can I define arrays using foreach loop by Juerd
in thread How can I define arrays using foreach loop by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":