foreach $hk (keys %$hash) { foreach $m (@{$hash->{$hk}->{member}}) { if($m eq $search) { print "$hk\n"; } } }