http://www.perlmonks.org?node_id=655287


in reply to Help with Search String

Define hash with searched words and check for hash key existance:
my %hash; @hash[qw(word1 word2)] = (1); if (exists($hash{$_})){ }
perlre, perldsc