If all it does is evaluate a variable, then you might want to use a dispatch table... with a code-ref
Something like:
my %dispatch = ( value1 => \&code_A(); value2 => \&code_B(); value3 => \&code_C(); ); # and in your code: if (exists $dispatch{$somevar}) { $dispatch{$somevar}->(); }
In reply to Re: Switch.pm or possible alternatives
by Animator
in thread Switch.pm or possible alternatives
by smack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |