in reply to Re^21: Reusing a complex regexp in multiple spots, escaping the regexp
in thread Reusing a complex regexp in multiple spots, escaping the regexp

It's much clearer now, much appreciated! 🙏🏻

Op-Tree manipulation is indeed "creative".

(I remember Merlyn complaining that the flip-flop was implemented in a similar way.)

> Its a bug which needs fixing

Well one could argue that a warning in combination with "injected" code should be enough, since it is such a rare combination. (Not sure if it's even possible to detect the interpolation of tied variables)

OTOH /o is also meant to improve performance, and executing stuff which is thrown away certainly defies this purpose.

I hope state isn't in the same trap of buggyness where the RHS is can have unexpected side effects on threaded Perl (???) °

If not the mechanism might be repurposed to fix /o.

Another, maybe easier, approach would be to semi-depricate/discourage /o by throwing a warning.

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

°) I should fire up Perlbrew to install a thread free Perl to run my experiments.

  • Comment on Re^22: Reusing a complex regexp in multiple spots, escaping the regexp

Replies are listed 'Best First'.
Re^23: Reusing a complex regexp in multiple spots, escaping the regexp
by dave_the_m (Monsignor) on Apr 18, 2026 at 16:07 UTC
    state is implemented sensibly. The /o implementation needs updating to behave like state. It's a hacky leftover from when the perl internals were first altered to be thread-safe.

    Dave.