in reply to Creating two dimensional array
use List::Util qw( max ); my @two_dim = map { [ $array1[$_], $array2[$_] ] } 0 .. max( $#array1, $#array2 );
This assumes you have List::Util (a safe assumption). If one array is longer than the other, the "missing" entries will be undef.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Creating two dimensional array
by doom (Deacon) on Oct 30, 2007 at 22:09 UTC |