foreach $x (@regex){ @bad_matches = grep ! m/$x/, @array; } #### foreach my $regex (@regexes) { @array = grep { ! m/$regex/ } @array; } #### my (@array); # is populated however you originally did my (@keepers); my (@bad); ITEM: # label added while (@array) { my $item = shift @array; foreach my $regex (@regexes) { if ($item =~ $regex) { push @bad, $item; next ITEM; # return to label } } push @keepers, $item; } # if you want it back on @array, just uncomment: # @array = @keepers;