#@words is a bunch of words , $line is the line to search if(!grep{$line !~ $_} @words) { #success }