in reply to Count occurrences and rename words in order
Something like this?
#! perl -sw my $data ='doc123/print doc456/read doc789/print doc145/print doc123/r +ead '; my @events = qw(print read); for (@events) { my $count = 1; $data =~ s/($_)/$1.$count++/ge; } print $data; __END__ # Output C:\test>198864 doc123/print1 doc456/read1 doc789/print2 doc145/print3 doc123/read2 C:\test>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Count occurrences and rename words in order
by Anonymous Monk on Sep 18, 2002 at 16:49 UTC |