Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: switch statement

by davido (Archbishop)
on Sep 20, 2013 at 05:35 UTC ( #1054959=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @dispatch = (
      [ sub { shift =~ m/test/ } => sub { action } ],
    ...
        last;
      }
    }
    
  2. or download this
    my @dispatch = (
      ... same as above ...
    ...
    $dispatch[                                    # In the table...
      firstidx { $_->[0]($test_value) } @dispatch # do a lookup...
    ]->[1]();                                     # and take action.
    
  3. or download this
    my @dispatch = (
      ...same as above ...
    );
    ( first { $_->[0]($test_value) } @dispatch )->[1]();
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054959]
help
Chatterbox?
Discipulus Eatalian is a sponge language..

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2017-11-21 10:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (297 votes). Check out past polls.

    Notices?