Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
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 lurking in the Monastery: (8)
As of 2015-07-30 10:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls