$match = 1; foreach $key ( keys %search ) { $match = 0, last if $record{$key} ne $search{$key}; } if ( $match ) { printresults($record); }