I didn't realize that the compiler was re-invoked after every loop. I thought the compilation takes place before the entire script is executed (or, I guess more correctly, I should say 'interpreted'). I didn't realize that the decision to compile the regex is done on every pass through the loop.
Certainly, with the regex compilation decision being invoked on every pass throught the loop, I would absolutely agree that it makes sense to, as you said "...precompiling the regex once per loop iteration for a loop with two dozen matches using that regex I think still makes sense...". That would, as you noted, be much more efficient than having to re-compile on every instance of regex throughout the loop...especially if you had many instances in the loop of using that regex.
Thanks. I really appreciate your helping me dig deeper into and learn more about the magic of regex's.
In reply to Re^5: Precompiling qr/.../o question
by ack
in thread Precompiling qr/.../o question
by vit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |