Don't ask to ask, just ask | |
PerlMonks |
Re: Perl/Unix caseby gothic_mallard (Pilgrim) |
on Oct 22, 2004 at 15:41 UTC ( [id://401532]=note: print w/replies, xml ) | Need Help?? |
Perl unfortuantly doesn't have a case statement but, as with most things, TMTOW to roll your own. The simplest, obviously, is with a set of if...elsif...else statements which does essentially the same thing if looking a little less elegant. The hash is another possibility and maybe faster than the if... route (but don't quote me on that), although unless you have lots of options then the difference is probably going to be negligable. All code is untested unless otherwise stated.
In Section
Seekers of Perl Wisdom
|
|