in reply to Filtering out stop words

If you're searching for an exact match you might as well use a hash:

my $commonWords = {}; # Make commonWords a ref to an empty hash ... while (my $line = <>) { chomp($line); $commonWords->{$line} = 1; } ... if ($CkDiscardCommonwords eq 1) { return(0) if exists $commonWords->{$term}; }
I suppose you extracted the code from your script and that's why you have a return outside of a function?