in reply to Searching hashes of hashes ...
Your data structure seems to be wrong. You show something that could be described as HoHoH, but I suspect you should really have a AoHoA. Consider:
use strict; use warnings; my @records = ({ EMPLOYER => "Widget Co.", EMPLOYEES => "jim", EMPLOYEES_FAMILY_MEMBERS => ["susan", "bill"], }, { EMPLOYER => "Widget Co.", EMPLOYEES => "john", EMPLOYEES_FAMILY_MEMBERS => ["liz", "bill"], }, { EMPLOYER => "Foo Ltd.", EMPLOYEES => "jim", EMPLOYEES_FAMILY_MEMBERS => ["karen", "bob"], }, ); my @selected = grep { "@{$_->{EMPLOYEES_FAMILY_MEMBERS}}" =~ /bill/ } grep { $_->{EMPLOYEES} =~ /jim/ } @records; print "Found ", join (", ", map { $_->{EMPLOYER} } @selected), "\n";
Prints:
Found Widget Co.
|
|---|