Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: using keys on hash of hash

by pjf (Curate)
on May 22, 2008 at 02:08 UTC ( #687867=note: print w/ replies, xml ) Need Help??


in reply to using keys on hash of hash

%{ 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


Comment on Re: using keys on hash of hash
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://687867]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (8)
As of 2015-07-03 17:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (54 votes), past polls