[HRPM] Perl switch statement
Jeff Duffy
jeff at alanne.com
Sun Jan 21 13:03:09 CST 2001
Greetings;
For those who might need it (I imagine that includes everyone), Damian
'The-Perl-community-pays-me-to-hack" Conway has released Switch-2.01,
a very nifty and very Perl implementation of the switch/case statement
found in many other languages.
http://search.cpan.org/search?dist=Switch
Highlights include:
- 18 different ways (!) to match a case statement, including lmatching
against iteral strings, regular expressions, hash key or value
existence (my favorite), subroutine output, and many more.
- Way flexible expression cascading (even forced fallthrough).
This is a very nice way to clean up some of that code you have with
fourteen sequential elsif statements :)
I'd be happy to cover this at a meeting, too.
Jeff
--
Errors have occurred.
We won't tell you where or why.
Lazy programmers.
-- Hacking haiku
More information about the Norfolk-pm
mailing list