Help for this page

Select Code to Download


  1. or download this
    my $foo ||= 1; # $foo is set to '1' if it was previously a false value
    
    my $bar //= 1; # $bar is set to '1' only if it was undefined (0 and em
    +pty string don't count).
    
  2. or download this
    sub routine {
         my $input_ref = {@_};
         my $var1      = defined $input_ref->{var1} ? $input_ref->{var1} :
    + 1;
    }