Help for this page

Select Code to Download


  1. or download this
    $foo = (split/:/,$_,3)[1];
    
  2. or download this
    cchan.acsys.com.1.256% cat aaa3.pl 
    use Benchmark; 
    ...
              'slice' => sub { (undef, my $foo) = split /:/,$str; },
                   'count' => sub { my $foo = (split/:/,$str,3)[1]; },
               });
    
  3. or download this
    Benchmark: timing 1000000 iterations of count, slice...
         count:  2 wallclock secs ( 3.18 usr +  0.01 sys =  3.19 CPU) @ 31
    +3479.62/s (n=1000000)
         slice:  3 wallclock secs ( 3.04 usr +  0.06 sys =  3.10 CPU) @ 32
    +2580.65/s (n=1000000)