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: (Score:1)