Help for this page

Select Code to Download


  1. or download this
    sub transpose {
      map { my $i = $_; [ map $_->[ $i ], @_ ] } 0 .. $#{ $_[0] }
    ...
    bc dd 34
    cd ee 56
    de gg 78
    
  2. or download this
    my @firsts  =   ( 1, 2, 3, 4 );
    my @seconds = qw( w x y z );
    ...
    
    my @foos = map foo( @$_ ), transpose \( @firsts, @seconds, @thirds );
    # @foos gets foo( 1, 'w', 5.6 ), foo( 2, 'x', 7.8 ), etc.