|
|
| more useful options | |
| PerlMonks |
Re: Hash versus chain of elsifsby LanX (Saint) |
| on Nov 22, 2021 at 10:32 UTC ( [id://11139012]=note: print w/replies, xml ) | Need Help?? |
|
The only thing in Perl which might be able to rival a hash look-up is a or-regex using the $in =~ m/^($STR1|$STR2|$STR3|...)$/ You should provide more details, for a definitive answer. But a trie will always beat if-else with eq comparisons.
Cheers Rolf
updates°) that's not the name... how was it called again... ah ... s/Tree/Trie/ > and does the "best" approach vary by scale? yes. see ${^RE_TRIE_MAXBUF}
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||