Not all is lost for Perl5. A hash containing subroutine refs can be equally readable, though fall-through can be difficult to achieve. It also has the advantage of having O(1) efficiency, just like switches in C (an interesting discussion of which is here).
In C switches, you trade off some flexibility for efficiency. Perl6 switches will allow any expression to be used as a case, so they're basically as efficient as a bunch of if/elsif statements (though I'm hoping simple cases will be optimized into something like a C switch).
----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer
: () { :|:& };:
Note: All code is untested, unless otherwise stated
In reply to Re: Re: Re: Switch (module) and Apache::Registry problem.
by hardburn
in thread Switch (module) and Apache::Registry problem.
by jdtoronto
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |