%{ expr } is your friend:
my $v = { h1 => { k1 => 1, k2 => 2, }, h2 => { k1 => 3, k2 => 4, }, }; my $interest = 'h1'; foreach my $key ( keys %{ $v->{$interest} } ) { print "$key has value $v->{$interest}{$key}\n"; } __END__ k2 has value 2 k1 has value 1
In reply to Re: using keys on hash of hash
by pjf
in thread using keys on hash of hash
by alecclews
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |