in reply to Getting a list of aliases to selected items from a list of array references

If you relax the requirements a little so that the sub operates on references instead of aliases, this would seem to work:
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

  • Comment on Re: Getting a list of aliases to selected items from a list of array references
  • Download Code