Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

broquaint (2964)

  (email not shown publicly)

Journal of broquaint (2964)

Thursday May 26, 2005
01:47 PM

Because you asked for it

[ #24891 ]
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";
  case 'celery';
  case 'rice-cracker';
  case 'plaster';
  case 'grass', sub {
    print "Your food is probably bland\n";
  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 ...

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.