in reply to grep match variable position
It will be easier and most probably more efficient to store your words in a hash and check for existence of your candidates in the hash.
Something like this:
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"; }
|
|---|