Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2016-09-29 06:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (548 votes). Check out past polls.