http://www.perlmonks.org?node_id=806119


in reply to Recursive substitution

There's

1 while s/^(a{1,3})(?=b)/$1a/;

but I'm sure you're going to say that's no good.

As you can see, what you're trying to do is a loop, not recursion.