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>

Cor! Like yer ring! ... HALO dammit! ... 'Ave it yer way! Hal-lo, Mister la-de-da. ... Like yer ring!

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
    It was something like that but I have more than those two events, but it works!!

    Thank you very much