in reply to Hash versus chain of elsifs
$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
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) 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}
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Hash versus chain of elsifs
by dsheroh (Monsignor) on Nov 23, 2021 at 08:32 UTC | |
by LanX (Saint) on Nov 23, 2021 at 11:42 UTC |