$temp = 3; $temp_1 = 4; @matching_rows = grep { $_->[0] == $temp && $_->[1] == $temp_1 } @array;