http://qs321.pair.com?node_id=1219800


in reply to Re^2: sequential substitutions
in thread sequential substitutions

Like this?

use strict; use warnings; my $i = 0; while(<DATA>){ s/<foo>.*?<\/foo>/"<foo>".++$i."<\/foo>"/e; print; } __DATA__ <foo>3</foo> <bar>a</bar> <foo>14</foo> <bar>bc</bar> <foo>159</foo> <bar>def</bar>