in reply to Re^3: Weighted frequency of characters in an array of strings
in thread Weighted frequency of characters in an array of strings

The chop version is wrong, it's trimming chars from the end, but counting them from zero. This fixes that:

for( @data ) { ## use $_ to alias the +lines my $p = length(); ## Allow pre-decrement +and count backwards $freq{ chop() }[ --$p ] += $inc while $p; ## implicit arg for cho +p; avoid call to length. }

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.
  • Comment on Re^4: Weighted frequency of characters in an array of strings (Bug fix.)
  • Download Code