Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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

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 taking refuge in the Monastery: (4)
As of 2016-06-25 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (325 votes). Check out past polls.