Enache Adrian <enache@rdslink.ro> wrote: :$entremets = "a"; :$appero = "b"; : :$/=\4096; : :while(<>) { : $a = not $a; : print if /(??{ : $a ? $entremets : $appero; : })/ :} For what it's worth, I've written code very like this to add assertions to regexps, and always did it like this: $true = qr/(?=)/; $false = qr/(?!)/; ... m{ match stuff (??{ ok() ? $true : $false }) match more }x; The main reason for doing that was to get around reentrancy problems (coredumps when trying to compile re's during a match); it appears that with 5.8.0 it is now safe to do: perl -wle ' $_=""; for $p (0,1,0,1) { print /(??{ $p ? qr{(?=)} : qr{(?!)} })/ ? "match" : "no match"; }' Precompiling the returned patterns bypasses the (obviously buggy) optimisation altogether. I think it might make most sense to remove the optimisation and document this as the recommended approach. HugoThread Previous | Thread Next