for my $foo (keys %var) { for my $bar (keys %{$var{$_}} { # You can access both now. } }