Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Finding something in hashes of hashes

by bobf (Monsignor)
on Dec 28, 2009 at 00:52 UTC ( #814562=note: print w/ replies, xml ) Need Help??


in reply to Finding hashes in hashes of hashes

This sounds fairly straightforward. What have you tried?

The sub is given a hashref ($families) and the value of a key in the inner hash ('bart'). The key to look in is specified in the sub name ('kid'). In pseudocode, I would do something like this:

for each family surname in the hash (%$families) get the value of the 'kid' key for the corresponding family hash if the value is 'bart', return the surname if the for loop completes the value wasn't found, so return or die

I hope that gets you started. Feel free to come back with more specific questions. Good luck!


Comment on Re: Finding something in hashes of hashes
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2014-12-20 18:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (97 votes), past polls