foreach my $token (@tokens) { if (grep /$token/i, @stopwords) { print "Stopword $token discarded\n"; } else { print "$token is okay\n"; } }