Help for this page

Select Code to Download


  1. or download this
    sub do_nothing {
     ...
     # return 'nothing'
     return ();
    }
    
  2. or download this
    wantarray ? : ;
    
  3. or download this
    #!/usr/bin/perl -w
    
    ...
    sub zero {
        return 0;
    }
    
  4. or download this
    scalar context _undef == $VAR1 = undef;
    
    ...
    scalar context nothing == $VAR1 = undef;
    
    list context nothing == $VAR1 = [];
    
  5. or download this
    sub routine {
        return undef;
    }
    
  6. or download this
    sub routine {
        return 0;
    }
    
  7. or download this
    #!/usr/bin/perl -w
    
    ...
    sub zero {
        return 0;
    }
    
  8. or download this
    Benchmark: timing 10000000 iterations of _undef, empty, nothing, zero.
    +..
        _undef:  2 wallclock secs ( 0.89 usr + -0.01 sys =  0.88 CPU) @ 11
    +363636.36/s  (n=10000000)
         empty:  2 wallclock secs ( 1.09 usr +  0.00 sys =  1.09 CPU) @ 91
    +74311.93/s   (n=10000000)
       nothing:  0 wallclock secs ( 0.50 usr +  0.00 sys =  0.50 CPU) @ 20
    +000000.00/s  (n=10000000)
          zero:  0 wallclock secs ( 0.06 usr +  0.00 sys =  0.06 CPU) @ 16
    +6666666.67/s (n=10000000)
    
  9. or download this
    sub build_list {
        my ($arg1, arg2, ...) = @_;
    ...
          return ();
        }
    }