http://qs1969.pair.com?node_id=219711


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?