in reply to Regexp optimization - /o option better than precompiled regexp?
it seems that option /o offers better performance that precompiled regexp.
A "precompiled regexp" is one that has no variables and is therefore compiled at compile-time, for example m/999986/ or m/^abc.*def/. Any regexp that contains a variable has to be compiled at run-time. The /o option means that the regexp is interpolated and compiled only once for the complete life of the program. Any other regexp that requires variable interpolation has to be interpolated and compiled each time that regexp is used. The qr// operator allows you to interpolate and compile a regexp once, at run-time, for example from user input.