in reply to Recursive substitution

if it can be done entirely inside the regex itself;

If what can be done? Change the position at which it will continue matching? Why don't you try it?

>perl -le"$_='abc'; /(.)(?{ pos = 0 })(.)/; print for $1,$2" a b

Guess not.

Replies are listed 'Best First'.
Re^2: Recursive substitution
by JadeNB (Chaplain) on Nov 10, 2009 at 12:15 UTC
    As indicated in my post (even the first version, not one updated out from under you—sorry), I did try modifying pos, to (as you point out) no avail. My question was just whether there was some other clever approach that I was missing.

      I did try modifying pos

      Yes, but not within the regex. Whatever it is you want to do, you said you wanted to do it within a regex.

      My question was just whether there was some other clever approach that I was missing.

      Again, another approach to do what?