in reply to
Longest String Matching
Reverse the string you're searching, and add the items you're searching for (reversed too) to a
Tree::Trie
, which is optimized for fast prefix searches. You're not using a has but it's still O(1).
Comment on
Re: Longest String Matching
In Section
Seekers of Perl Wisdom