in reply to Getting a list of aliases to selected items from a list of array references
sub mapfirst { my( $sub )= shift( @_ ); &$sub( map { \($_->[0]) } @_ ); # ^^^^^^^^^^^^^^^^^^ Here is the selection code } my @a= ( 1..3 ); my @b= ( 4..6 ); my @c= ( 7..9 ); sub addten { $$_ += 10 for @_ } mapfirst( \&addten, \@a, \@b, \@c ); mapfirst( sub { print join " ", map{$$_} @_; print "\n" }, \@a, \@b, \ +@c );
-Mark
|
|---|