$test =~ s/1/++$i/eg; [download]
In reply to Re: incremental substitution w/ regexp only? by ikegami in thread incremental substitution w/ regexp only? by peter.mao