@temp_array = (\@arry1, \@arry2); my @exists = grep { $_->[0] eq $temp1 && $_->[1] eq $temp2} @temp_array ;