=item my @result = map2 BLOCK ARRAY, ARRAY; Similar to c, but operate on two lists at once. Inside the BLOCK, the value are passed in as C<$a> and C<$b> (as in C). my @a = ( 1, 2, 5, 7, ); my @b = ( 3, 4, 6, 8 ); my @sums = map2 { $a+$b } @a, @b; my @prods = map2 { $a*$b } @a, @b; One use is to initialize hashes from two arrays. You can do this in straight perl with: my %hash; @hash{@hash_keys} = @values; With this subroutine, you could also do: my %hash = map2 { ( $a => $b ) } @hash_keys, @values; If the arrays are not the same length, the shorter array is used to limit how far we go in each array. BLOCK is evaluated in list context. =cut sub map2 ( & \@ \@ ) { my ( $code_ref, $a_ref, $b_ref ) = @_; my $rv_len = ( @$a_ref < @$b_ref ) ? @$a_ref : @$b_ref; my @rv; for ( my $i = 0; $i < $rv_len; ++$i ) { local ( $a, $b ) = ( $a_ref->[$i], $b_ref->[$i] ); push @rv, $code_ref->(); } return @rv; }