Help for this page

Select Code to Download


  1. or download this
    $dir= $ENV{TMPDIR} || "/tmp";
    $file ||= "default";
    
  2. or download this
    $size= defined $ENV{MAXSIZE} ? $ENV{MAXSIZE} : -1;
    $size= -1   if  ! defined $size;
    
  3. or download this
    $size= def( $ENV{MAXSIZE}, -1 );
    def( $size, -1 ); # void context causes $size to be modified
    ...
    # The third argument above forces $size to be modified
    # even though no void context used.  An alternative is:
    if(  0 < ( $size= def $ENV{MAXSIZE), -1 )  )
    
  4. or download this
    sub def {
        my( $val, $alt, $force )= @_;
    ...
        $_[0]= $val   if  ! defined wantarray  ||  $force;
        return $val;
    }