my @new_data; for my $i ( 0 .. $#data ) { $data[$i][1] != $compare[$i] and push @new_data; } # replace: @data = @new_data;