foreach my $k1 (keys %bighash) { foreach my $k2 (keys %{$bighash{$k1}}) { ... push(@keys,[$k1, $k2, ...]);