Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Understanding the benefit of Given/When ...

by JavaFan (Canon)
on Mar 04, 2010 at 15:14 UTC ( #826721=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    {
        given ($foo) {
    ...
    } continue {
        ... always executed ...
    }
    
  2. or download this
    given ($foo) {
        when (/bar/) {...}
        when (/baz/) {...}
    }
    ... always executed ...
    
  3. or download this
    my $foo = "bar";
    my @foo = qw [foo bar baz];
    given ($foo) {
        when (@foo) {say "Match"}
    }
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (13)
As of 2016-06-28 21:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (363 votes). Check out past polls.