Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: Given When Syntax

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

Help for this page

Select Code to Download


  1. or download this
    test2(1.00.000);
    
  2. or download this
    test2("1.00.000");
    
  3. or download this
    sub test2 {
        my ($var2) = @_;
    ...
        return ("Three")  if ($var2 == /^3/ );
        return undef;
    }
    
  4. or download this
    sub test2 {
        my ($var2) = @_;
    ...
        return ("Three")  if ($var2 =~ /^3/ );
        return undef;
    }
    
  5. or download this
    sub test2 {
        my $var2 = substr shift, 0, 1;
    ...
        return ("Three")  if $var2 == 3 ;
        return undef;
    }
    
  6. or download this
    use strict;
    use warnings;
    ...
        return $translation[(substr shift, 0, 1)];
    }
    print test2("1.00.000");
    
  7. or download this
    use strict;
    use warnings;
    ...
        test_3 => sub {test3("3.01.000")},
        }
    )
    
  8. or download this
    $ perl test_if.pl
                Rate test_1 test_2 test_3
    test_1 1294050/s     --   -11%   -51%
    test_2 1451608/s    12%     --   -45%
    test_3 2642856/s   104%    82%     --
    

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2019-03-25 05:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How do you Carpe diem?





    Results (115 votes). Check out past polls.

    Notices?