in reply to Count occurrences and rename words in order
#!/usr/bin/perl -w use strict; $_ = 'doc123/print doc456/read doc789/print doc145/print doc123/read'; my %counts; s|(/\w+)|$1 . ++$counts{$1}|ge; print;
Seems to give the right output for the sample you gave.
--"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Count occurrences and rename words in order
by flounder99 (Friar) on Sep 18, 2002 at 16:28 UTC | |
by davorg (Chancellor) on Sep 18, 2002 at 16:33 UTC | |
|
Re: Re: Count occurrences and rename words in order
by Anonymous Monk on Sep 18, 2002 at 16:46 UTC | |
by davorg (Chancellor) on Sep 18, 2002 at 16:50 UTC |