Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: switch statement

by sundialsvc4 (Abbot)
on Oct 01, 2015 at 15:35 UTC ( [id://1143573]=note: print w/replies, xml ) Need Help??


in reply to switch statement

Dunno why the Perl language did not include some form of switch in any of its incarnations, but I also do not care for the various graft-on implementations that try to provide it.   Corion’ suggestion to use a dispatch table ... which is simply an array or hash of subrefs ... is a good one.   Otherwise, frankly, I would just knuckle down and make peace with if...elsif..elsif....   If you are careful to spin-off the various cases into separate subs, for clarity, it actually is about as sweet as the (syntactic ...) sugar.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1143573]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-03-19 04:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found