Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Given When Syntax

by Laurent_R (Canon)
on Mar 15, 2014 at 16:39 UTC ( #1078466=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @array = qw /One Two Three/; 
    my $var = 2;
    print $array[$var], "\n";
    
  2. or download this
    my %hash = ( 1 => One, 2 => Two, 3 => Three);
    my $var = 2;
    print "$hash{$var}\n";
    
  3. or download this
    my ($oper, $rest) = shift, join ' ', @_;
    my $stop = 'stop';
    ...
    else {
        die "Unknown operation: $oper \n";
    }
    
  4. or download this
    my %dispatch_table = (
        stop => sub {run_stop($rest); cleanup();},
    ...
        start => /&run_start(@rest),
        force_start => sub  {run_stop ($rest); cleanup() ; run_start ($res
    +t);},
    );
    
  5. or download this
    my ($oper, $rest) = shift, join ' ', @_;
    if (defined $dispatch_table{$oper}) {
    ...
    } else {
        die "Unknown operation: $oper \n";
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078466]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2018-12-11 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many stories does it take before you've heard them all?







    Results (57 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!