in reply to Matching Many Strings against a Large List of Hash Keys (case insensitively, longest key first)

The more you know about the data, the better. For instance, if most strings will not match, you could do some preprocessing: for each string, split it on whitespace. Have a hash of all the first words of the keys of %hash; if none of the words in the string are in the hash, there cannot be a match. Obviously, this will not do you any good if all strings will have a match. Also, is it important to check the keys in a specific order? Or are you satisfied if any key matches? And why do you have %hash if you aren't using its values?
  • Comment on Re: Matching Many Strings against a Large List of Hash Keys (case insensitively, longest key first)