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>
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: sequential substitutions
by Anonymous Monk on Aug 03, 2018 at 11:56 UTC | |
by AnomalousMonk (Archbishop) on Aug 03, 2018 at 15:00 UTC | |
by hdb (Monsignor) on Aug 06, 2018 at 08:25 UTC |