On Sun, 19 Apr 2020, yary wrote: > How would one do s/(.+),(.+)/$1,$0/ using .subst ? > -y
You can pass a code block as the second argument which assembles the replacement text. The block is evaluated anew for every substitution and it has access to the latest captures: say .subst(/(.*) ',' (.*)/, { "$1,$0" }) for «a,z 10,12 l,25» # z,a # 12,10 # 25,l Regards, Tobias -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk