%a = (foo => 1, bar => 2); %b = (goo => 1, dar => 2); while ( my ($i, $j) = each %a ) { while ( my ($x, $y) = each %b ) { print "$i $j $x $y\n"; } }