Because you asked for it

broquaint on 2005-05-26T18:47:28

For the folks who wanted C style switching behaviour in Switch::Perlish (version 1.4):

use Switch::Perlish 'C';

my $food = shift; switch $food, sub { case 'pizza'; case 'burger'; case 'fried-chicken'; case 'tub-o-lard', sub { print "Your food is probably delicious\n"; stop; }; case 'celery'; case 'rice-cracker'; case 'plaster'; case 'grass', sub { print "Your food is probably bland\n"; stop; }; default sub { print "Your food is without compare\n"; }; };


You can also match mutliple things in the normal style using an anonymous array. i.e

case [qw/ pizza burger fried-chicken tub-o-lard /], sub { ... }


Different keystrokes for different folks ...


Re:

Aristotle on 2005-05-27T19:59:52

Very pretty! I like it. Lots.