use strict; my @array = qw (bga); my @new_array = qw (bga cbga test); my @tester; print "@array\n"; # #foreach my $temp(@array) { # chomp($temp); # @tester = grep !/^$temp$/ig,@new_array; #} my $temp='('.(join'|',@array).')'; @tester = grep !/^$temp$/ig,@new_array; print "@tester\n";