Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Given When Syntax

by Laurent_R (Canon)
on Mar 15, 2014 at 16:39 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1078466]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-25 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found