Now you've confused me:)
Doesn't O(1) (in this case) mean that a condition is only tested once with the C-switch statement. Whereas the implementation shown in the OP, all tests from 0 to N where N is the met condition's lexical position within the group, hence worst case O(N) if the last case is the one chosen?
It was this bit of your post that confused me
...Im wracking my brain to see how this could be done without becoming hopelessly inefficient....
In reply to Re: Re: Re: Perl Idioms Explained: && and || "Short Circuit" operators
by BrowserUk
in thread Perl Idioms Explained - && and || "Short Circuit" operators
by davido
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |