in reply to Counting the frequency of words in a string

thanks for the answers.

some people missed the "dont need to count individual words" part, but for the sake of future reference, this could be done like so:

my %count; $count{$1}++ while $text =~ /($keyword_regex)/g;

and you could find some percentage of relevancy with:

use POSIX qw(ceil); print ceil(keys(%count) / (@keyword_list) * 100);

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