Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2016-06-25 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (322 votes). Check out past polls.