my $word = "of"; my %stopwords = map { $_ => 1 } qw/ a the of /; if (exists $stopwords{$word}) { print "Stopword $word discarded\n"; } else{ print "$word is not a stop word\n"; }