Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Case structures using a hash

by BronzeWing (Monk)
on Dec 13, 2002 at 19:23 UTC ( [id://219711]=note: print w/replies, xml ) Need Help??


in reply to Case structures using a hash

++!
But what about an else/default case? I'd put something like this:

&{ ($PSUEDO_SWITCH{$match}||$PSUEDO_SWITCH{'ELSE'}) }('arg1', 'arg2', 'arg3');

-BronzeWing


Perl Monks do it more than one way.

Replies are listed 'Best First'.
Re: Re: Case structures using a hash
by hardburn (Abbot) on Dec 13, 2002 at 19:30 UTC

    Excelent point. If you need a "default" case, that is probably the best way to do it.

    Also, I'm wondering about ways of performing fall-through on the cases. Perhaps the end of each subroutine could call explicitly call the next referance?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-24 02:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found