for (my $i = 0; $i < @erg1; $i++) { $exists = grep /$erg1[$i]/, @erg2; }