texuser74 has asked for the wisdom of the Perl Monks concerning the following question:
Input: <xxx>...</xxx> <p>...</p> <xxx>...</xxx><xxx>...</xxx> <p>...</p>
my present code inserts only for first occurance of <xxx>.Output: <1><xxx>...</xxx> <p>...</p> <2><xxx>...</xxx><3><xxx>...</xxx> <p>...</p>
pls, help me how to code this.if(/<xxx>/){ s/(<xxx>)/<$cnt>$1/; ++$cnt; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: find and replace counter
by msbalaji (Chaplain) on Jan 08, 2008 at 06:38 UTC | |
by hipowls (Curate) on Jan 08, 2008 at 07:20 UTC | |
by texuser74 (Monk) on Jan 08, 2008 at 07:11 UTC | |
|
Re: find and replace counter
by poolpi (Hermit) on Jan 08, 2008 at 09:24 UTC |