in reply to Strange behaviour when regex variable is modified during match?

You have not said what you are trying to do, or what behavior you expect, so all I can do is make some observations:

The usual way to modify a string is to use the substitution operator s/regexp/replacement/.

Replies are listed 'Best First'.
Re^2: Strange behaviour when regex variable is modified during match?
by rsFalse (Chaplain) on Jan 17, 2021 at 20:39 UTC
    I was only playing with regex and eval inside. I tried to generate some substitution patterns, e.g. zipping or meshing chars.

    Sincerely, earlier today I found other "bug" (=feature) that $_ inside (?{ ... }) binds to LHS after I tried to manipulate $_ as a global. But I found in perlre that it is desired behaviour. So then I tried to play with this feature.
Re^2: Strange behaviour when regex variable is modified during match?
by Anonymous Monk on Jan 18, 2021 at 16:01 UTC
    Definitely you are playing too close to the underlying implementation of regex and need to find a different way to do what you're trying.