Is the following code what you're looking for ?
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";
UPDATE :
Ooops davorg said it faster...
Furthermore if it's case-sensitive 'ne' is better than the regex used in my examples...
UPDATE2 :
Thanks
Davorg for catching my error !
Only the last element of array will be taken out of the list,
as the @tester array is completly reconstructed at each step of the loop (only ok with one element ;-)
I've corrected the code with another solution...
But you'd definitly better use
davorg's one.
"
Only
Bad
Coders
Code
Badly
In
Perl" (OBC2BIP)