Problems? Is your data what you think it is? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Hm, not entirely sure what will make things faster, but a few ideas:
You probably don't need to store your data into an array, and then go through the array, compute your counters right away when reading the data; Use a hash of counters : $freq{$_} ++; Don't do the division for each single letter: compute the counters, and only at the end, do the four needed divisions; or calculate 1/@data only once into a variable, and use the variable; Using tr// is likely to be faster than a regex to count the letters. For example:
In reply to Re: Weighted frequency of characters in an array of strings
by Laurent_R
|
|