XP is just a number | |
PerlMonks |
Re: Best option for "switch/case" functionality?by BrowserUk (Patriarch) |
on Jun 27, 2016 at 20:28 UTC ( [id://1166693]=note: print w/replies, xml ) | Need Help?? |
A hash of coderefs is perfect if your cases are all constants, but if you want something that is closer to Switch or given/when, without the headaches, take a look at Dan Brook's Switch::Perlish which allows (for example) a coderef against a hash, or a regex against an array, and many more combinations; but with clear and sane rules about what each combination does. It's what given/when with smart matching could have been; but with slightly more cumbersome, but still eminently readable syntax. With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice. Not understood.
In Section
Seekers of Perl Wisdom
|
|