in reply to Switch.pm or possible alternatives
What marvellous timing as I can point you to my new module, Switch::Perlish (which should be available on CPAN any moment now if it isn't already). So extrapolating from your node this code should do the job:
use Switch::Perlish; switch $your_var, sub { case 'this', \&this_function; case 'that', \&that_function; case 'the', \&the_function; case 'other', \&other_function; default sub { print "Nothing matched '$your_var'\n" }; };
HTH
_________
broquaint
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Switch.pm or possible alternatives
by BrowserUk (Patriarch) on May 21, 2005 at 15:39 UTC | |
Re^2: Switch.pm or possible alternatives
by smack (Beadle) on May 25, 2005 at 11:18 UTC |
In Section
Seekers of Perl Wisdom