There's more than one way to do things | |
PerlMonks |
Re: Longest String Matchingby pemungkah (Priest) |
on Apr 08, 2013 at 20:35 UTC ( [id://1027592]=note: print w/replies, xml ) | Need Help?? |
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).
In Section
Seekers of Perl Wisdom
|
|