my @in = qw(bga cbga test); my @out = @in; my @test = qw(bga); foreach my $test (@test) { @out = grep { $_ ne $test } @out; }