nothign has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to create a 3 dimensional array
I've done two dimensionals.. (just a snipit for printing it)
But the three dimensionals seem beyond me. This piece is supposed to pull items off of some input $_ one buy one and push them one by one to a different array (thats inside of an array called column, thats inside of an array called row)@nine = (0,1,2,3,4,5,6,7,8); foreach $row (@nine) { foreach $column (@nine) { print "$matrix[$row][$column]"; } print "\n"; }
I had the two dimensional version pulling one by one off of $_ and assigning them to the elements in $matrix$row$column and that worked fine.
foreach $row(@nine) { foreach $column(@nine) { s/\d//; push(@matrix[$row][$column], $&); } }
Basically I want a 9 by 9 matrix that hold an array instead of just a scaler.
I can implement the array I want well enough the long way.. But as you see in my horrible code, I don't have the knowledge required to reference it.
Oh please, mighty perl monks, lend me your knowledge so that I might continue on my perl journey
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Multi-dimensional arrays...
by ikegami (Patriarch) on May 31, 2009 at 18:17 UTC | |
by nothign (Novice) on May 31, 2009 at 18:38 UTC | |
by johngg (Canon) on May 31, 2009 at 19:12 UTC | |
by nothign (Novice) on May 31, 2009 at 19:54 UTC | |
|
Re: Multi-dimensional arrays...
by Anonymous Monk on May 31, 2009 at 18:15 UTC | |
|
Re: Multi-dimensional arrays...
by locked_user sundialsvc4 (Abbot) on May 31, 2009 at 22:06 UTC | |
|
Re: Multi-dimensional arrays...
by hda (Chaplain) on Jun 01, 2009 at 05:40 UTC |