my @good = grep { my $yes = $_; !first {$_ == $yes} @notgood; } @goodarray;