my %form; my %field = ( 'key 1' => 'value 1', 'key 2' => 'value 2', ); $form{another_hash} = \%field; for my $first_key ( keys %form ) { for my $hoh_keys ( keys %{ $form{$first_key} } ) { print $hoh_keys, $/; ## get the keys } } #### use Data::Dumper; ... print Dumper \%form; #### $VAR1 = { 'another_hash' => { 'key 2' => 'value 2', 'key 1' => 'value 1' } };