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

sickboy has asked for the wisdom of the Perl Monks concerning the following question:

hey,
say i had friends. A thousand of those little suckers.
for (@raw_list) { my @entry = split(/,/, $_); $sucker= { FIRSTNAME => $entry[0], LASTNAME => $entry[1], HAIRCOLOR => $entry[3], }; $friends{$n}=$sucker; }
i want to be able to query this %friends for say
all the people that have brown hair and a first name starting with the letter j*.
I have come up with ways to do this, but i dont want to have to :
foreach $n (sort keys %friends) { $sucker=$friends{$n}; if ($sucker->{FIRSTNAME}=~/^j.*/) {$d++;} ect...
Please refrain from the "i won't give you the code because.."