in reply to Re^2: Finding hashes in hashes of hashes
in thread Finding hashes in hashes of hashes
The 'die' would go after the foreach (refer to the pseudocode that I posted). Note the comments below:
sub get_family_member { my @args = @_; my $who = shift @args; # <-- this var is not used my $families = shift @args; foreach my $family (%families) { if ($families->{$family}->{kid} eq "bart") { # <-- are you sure yo +u want to hard-code 'bart'? I think you need $who return $dfamilies->{$family}->{kid}; # <-- typo in hash name last; # <-- this will never be reached since it already returned } } # no matches found: die here }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: Finding hashes in hashes of hashes
by AnomalousMonk (Archbishop) on Dec 28, 2009 at 20:07 UTC | |
Re^4: Finding hashes in hashes of hashes
by cyphy (Initiate) on Dec 29, 2009 at 14:26 UTC |
In Section
Seekers of Perl Wisdom