Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Case structures using a hash

by BronzeWing (Monk)
on Dec 13, 2002 at 19:23 UTC ( #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');


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?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2023-02-07 02:12 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (38 votes). Check out past polls.