my %remove = map { $_ => 1 } @badWords; my @goodWords = grep(!defined $remove{$_}, @myArray);