Just a wild guess, but I'd say there's some weird interaction going on between the aliased copies of $1 and $2 that are being passed as arguments and the subsequent s/// operators clobbering the existing contents thereof.
In reply to Re: Regex capture consumed by non-capturing match
by Fletch
in thread Regex capture consumed by non-capturing match
by ribasushi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |