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


in reply to Re: matching an array of alternates
in thread matching an array of alternates

Just wanted to point out that if the file you're searching has a lot of lines, you can gain some speed by adding the "o" option to the regex; i.e.:
print $1 if /$regex/o;
This way, the regular expression only has to be compiled once.

- Zoogie