in reply to Counting the frequency of words in a string

You could use split, but if your string is English you should probably use Lingua::EN::Splitter or Lingua::EN::Segmenter::TextTiling to split it into words as this has more logic in it to treat apostrophes etc. that may be in a legitimate single word.

Then use a hash to store counts.

  • Comment on Re: Counting the frequency of words in a string