in reply to functional opposite of zip

Doesn't seem to be anything that does exactly what you want. Expanding on tanktalus's responses, I offer the following:
sub unzip(&@) { my $code = shift; my @retlist; while(@_) { local $_ = \@_; push @retlist, $code->(); } return @retlist; } use Data::Dumper; my %h = qw(k1 v1 k2 v2); print Dumper [unzip {[shift @$_,shift @$_]} %h];
This one will work regardless of the number of items accessed in the code block, because those items are shifted out as the sub works. However, it requires that you refer to the items using shift @$_ rather than your preferred $_[0], etc. Also, this method will preserve the order of a list if invoked on a genuine list rather than a hash.
sub unzip(&\%) { my $code = shift; my %hash = %{shift()}; my @retlist; while(my @list = each %hash) { push @retlist, $code->(@list); } return @retlist; } use Data::Dumper; my %h = qw(k1 v1 k2 v2); print Dumper [unzip {[$_[0], $_[1]]} %h];
This one matches your desired syntax exactly, but will only work for hashes, that is the argument %h must be a hash. Also, since it's a hash the order of the result is undefined (as is the standard behavior of each).