TASdvlper has asked for the wisdom of the Perl Monks concerning the following question:
I would like to set up an array that points to another array (basically, each index points to another anonymous array). But, I want to build the second array within a for loop. For example:
I tried using push($myarray[0], $_) within the for loops, but that didn't work.my @myarray for (1..5) { # here I would like $myarray[0] = ( 1, 2, 3, 4, 5 ); } for (6..10) { # here I would like $myarray[1] = ( 6, 7, 8, 9, 10 ); } ## and so on.
Any thoughts on how to do this ?
Thanks in advance.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Arrays that points to another array
by hardburn (Abbot) on Jan 29, 2004 at 21:09 UTC | |
by Not_a_Number (Prior) on Jan 29, 2004 at 21:15 UTC | |
|
Re: Arrays that points to another array
by Roy Johnson (Monsignor) on Jan 29, 2004 at 21:11 UTC | |
|
Re: Arrays that points to another array
by Roger (Parson) on Jan 29, 2004 at 23:48 UTC | |
|
Re: Arrays that points to another array
by NetWallah (Canon) on Jan 29, 2004 at 22:35 UTC | |
|
Re: Arrays that points to another array
by allolex (Curate) on Jan 29, 2004 at 22:28 UTC |