laziness, impatience, and hubris | |
PerlMonks |
Re^2: Count number of occurrences of a list of words in a fileby Cristoforo (Curate) |
on May 09, 2018 at 22:28 UTC ( [id://1214299]=note: print w/replies, xml ) | Need Help?? |
Athanasius identified the code slowdown here. Hash lookups are the fastest way here and generally. The 2 lookups are necessary because you have to verify that the word being checked exists in the counting hash. Otherwise, without this check, a new word (not to be searched for) would be erroneously counted in the hash.
In Section
Seekers of Perl Wisdom
|
|