sub map_pairs(&@) { my $f = shift; my @res; no strict 'refs'; no warnings 'once'; my $caller = caller; local(*{$caller."::a"}) = \my $a; local(*{$caller."::b"}) = \my $b; push @res, $f->($a,$b) while ($a, $b) = splice @_, 0, 2; return @res; } #### map_pairs { $a } qw/a b c d/; # ac map_pairs { $b } qw/a b c d/; # bd map_pairs { uc($a),lc($b) } qw/a b c d/; # AbCd