in reply to Re^2: Problem with pre-compiled regex
in thread Problem with pre-compiled regex

>but shouldn't the pre-compiled regex run faster

Not necessarily From perlop

Since Perl may compile the pattern at the moment of execution of qr() operator, using qr() may have speed advantages in some situations,...

And not any more as often as it used to be!

...Perl has many other internal optimizations, ...

(emphasizes added)

UPDATE: Furthermore in both your code examples the regexes are just compiled and used once.

Cheers Rolf

Replies are listed 'Best First'.
Re^4: Problem with pre-compiled regex
by JavaFan (Canon) on Jan 17, 2012 at 16:34 UTC
    Actually, the regexes are used twice eacg - they first both match, then fail.