When you perform a pattern matching with multiple “or” (|) clauses, such as /pattern1|pattern2|pattern3/, Perl regexp engine will try to match each of them one after the other in sequence, resulting in poor performance if you have a long list of “or” clauses.
In order to optimize such a pattern matching, you can use the Regexp::Assemble module.
Continue reading Perl : Optimizing pattern searches with Regexp::Assemble