in reply to error:Global symbol "$stopwords" requires explicit package

You probably use strict; and if you didn't, you should... That means (among some other things) that you must declare your variables with 'my' before using them (that's extremely useful against typos).
Something like this:
#!/usr/bin/perl use strict; # declare the variables my $stopwords = "word"; my @data = qw( a word another and a verb a noun a phrase); my @lessWords; foreach my $word (@data) { if ($stopwords !~ / $word /) { push @lessWords, $word; } } print "@lessWords\n";