|We don't bite newbies here... much|
1. Why does the qr// operator accept the /o midifier?
So that you can create a 'static' compiled regex object that can be interpolated in to more complex patterns subsquently in the program.
2. If you combine one or more parts defined with qr// in a regex with some non-precompiled stuff, do you still get the advantage of precompilation?
The discussion on p194 of Camel 3rd Ed. states that you can 'chain' qr// operaters into one pattern to prevent re-compilation, so the answer would appear to be 'no'.
3. If there was a non-compiled var reference in the above m//, do I still get any benefit from pre-compiling the other parts?
No; again, according to the reference above, the pattern would be re-compiled.
4. What happens if I add a /o modifier to the m// above?
You'd get a once-only compilation of the pattern.
5. If one or more of the per-compiled parts (and/or the non-precompiled parts) contains capture brackets, was there any benefit (in performance terms) from pre-compiling some parts?
I doubt that the presence or absence of capture brackets makes much difference to whether or not precompilation provides any benefit.