in reply to Creating Symmetrical AoA from some Arrays

my @all = map {[ $arr1[$_], $arr2[$_], $arr3[$_] ]} (0..@arr-1);
Update: typo corrected..thanks to ikegami's notice.

Regards,
Edward

Replies are listed 'Best First'.
Re^2: Creating Symmetrical AoA from some Arrays
by ikegami (Patriarch) on Nov 25, 2005 at 06:07 UTC

    @pat-1
    should be
    @arr1-1
    and can be written as
    $#arr1

    The following should be a bit faster and much more memory efficient (but not as neat):

    my @all; push(@all, [ $arr1[$_], $arr2[$_], $arr3[$_] ]) foreach 0..$#arr1;

    Even faster?

    my @all; $#all = $#arr1; $all[$_] = [ $arr1[$_], $arr2[$_], $arr3[$_] ] foreach 0..$#arr1;