while() { chomp; if (m/^static\s+\w+\s+($names[0]|$names[1]|$names[2])\W.*/) { print "Beatle method \"$1\" found on this line: $_\n"; } else { print "No Beatle method found on this line: $_\n"; } }