I am trying to take a list (@list) and split it up into an array of 38 arrays each contains 38 values from my @list, they are already in order it just has to step through and get the data. moving it from @list to my 2d array @temp as it goes here is the code for the sub i am using
use strict; use warnings; sub sortList{ my @temp ; my (@list) = @_; my $j; my $count = 0; for (my $i =0; $i< 38; $i += 1){ for ( $j=0; $j<38; $j+= 1){ push (@{$temp[$i]}, $list[$count]); $count += 1; } } return @temp; }
rather than getting the values in my my output i am getting a list of array reference numbers not sure why. This is my first time using a 2D array any wisdom would be appreciated
In reply to 2D arrays by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |