in reply to Alternation vs. looping for multiple searches.

If the patterns are simple (patterns with no characters having any special meaning) I expect the loop to be faster. This is because the simpler the string, the more chance there is the optimizer does all, or most, of the work.

For more complicated patterns, it will depend on several things; to name a few:

Whether a loop or a pattern with alternations is faster will depend from case to case. The only way to make sure is to run a benchmark, and even then you only have an answer for a specific set of patterns, a specific set of data, a specific version of Perl (version-number, compilation options, compiler used), and a specific OS. Change one of these things, and you may get a different result.
  • Comment on Re: Alternation vs. looping for multiple searches.