in reply to Converting string into index MD array
Since multi-dimensional arrays in Perl are just arrays of arrayrefs (of arrayrefs of...), this starts with a reference to the top-level array, then walks down through each level, getting the reference to the next level, until it reaches the end.my @number = qw(2 3 4 5); my $curr_array = \@MDarray; while ($#number > 0) { # Stop when 1 element left my $index = shift @number; $curr_array = @$curr_array[$index]; } @$curr_array[$number[0]] = # Do something
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Converting string into index MD array
by FFRANK (Beadle) on Jul 17, 2007 at 15:59 UTC |