http://qs321.pair.com?node_id=1214299


in reply to Re: Count number of occurrences of a list of words in a file
in thread Count number of occurrences of a list of words in a file

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.