You are asserting that any time you interpolate a compiled re into another, it just stringifies the first anyway, and re-compiles the whole thing?That's no assertion. That's how it works.
I had always assumed that it copies the compiled bits and does not need to re-process it.No, that's not really possible to do (think for instance paren counts - or consider this: $q = qr/x/; $r = qr/[$q]/). It only works in this case:
Use use re 'debug' and you will see what strings are being compiled.my $qr1 = /pattern/; my $qr2 = /$qr1/;
In reply to Re^7: Composing regex's dynamically
by JavaFan
in thread Composing regex's dynamically
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |