http://www.perlmonks.org?node_id=814566


in reply to Re: Finding hashes in hashes of hashes
in thread Finding hashes in hashes of hashes

That's a step in the right direction, but it fails to test the relationship (called $status in your example) to ensure the match is on the 'kid' key. Your code, as written, will return the surname of the first family tested that contains the name of interest. For example, if the Flintstones' father was also named 'bart' and if that family came first in the foreach loop, the function would return 'flintstones' rather than 'simpsons'.

BTW, the OP did not specify how the code should handle multiple matches (in the event more than one family has a 'kid' named 'bart').