in reply to Re: how to count the no of repeats in a string
in thread how to count the no of repeats in a string
Why take the trouble of making the hash increment inside the pattern instead of in the loop? That kind of cheats the loop expression of its task. :-)
my %counts; $counts{$1}++ while $string =~ /([^,]+)/g;
lodin
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how to count the no of repeats in a string
by ikegami (Patriarch) on Nov 14, 2007 at 02:30 UTC | |
by lodin (Hermit) on Nov 14, 2007 at 03:08 UTC |