my %h = qw( one 1 two 2 three 3 four 4 ); while (my($k, $v) = each %h) { say "$k=$v"; frobnicate(\%h); } sub frobnicate { keys %{ $_[0] } }