Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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 browsing the Monastery: (7)
As of 2014-12-27 22:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls