in reply to Search Categories - Most efficient way

I tried doing 'if' commands to cover all the possible combinations the user wants to search for, but the coding is way to long and to many possible cominations!

Load your search criteria into a hash. Load each record into a hash. Then, to see if a record matches, do

$match = 1; foreach $key ( keys %search ) { $match = 0, last if $record{$key} ne $search{$key}; } if ( $match ) { printresults($record); }
What this doesn't handle is a search for a 35-45 year old single women in Silicon Valley who appreciates gearheads. Fortunately, I married one.