%hash = {'match1'=> 1; 'match2' => 1; } foreach $row (@file) { if (exists hash{$$row[0]}) { ## do something } }