G
Geoff Cox
Hello
I want to use regex to find/replace say <jim> with $num-fred<jim> so
that $num increase by 1 for each occurrence.
It might that there are 2 of <jim> on a line so my code below is not
working - how should I change it? Clues please!
$num = 1;
if ($line =~ /<jim>/) {
my $orig = "<jim>";
my $new = "$num-jim";
$line =~ s/$orig/$new/g;
$num++;
}
Thanks
Geoff
I want to use regex to find/replace say <jim> with $num-fred<jim> so
that $num increase by 1 for each occurrence.
It might that there are 2 of <jim> on a line so my code below is not
working - how should I change it? Clues please!
$num = 1;
if ($line =~ /<jim>/) {
my $orig = "<jim>";
my $new = "$num-jim";
$line =~ s/$orig/$new/g;
$num++;
}
Thanks
Geoff