Help for this page

Select Code to Download


  1. or download this
    # syntax
    lvalue ?= op value;
    ...
    $highest ?= lt substr($_, 10, 5);
    # ex: $foo ||= $bar, using the generalized ?= operator
    $foo ?= || $bar;
    
  2. or download this
    # ex: $foo = $default if !defined($foo)
    $foo ?= !defined $default;
    # ex: $foo{'bar'} = $default if exists($foo{'bar'})
    # That is, we're resetting the value, but not creating it
    $foo{'bar'} ?= exists $default;
    
  3. or download this
    # $foo = uc($foo)
    $foo ?= uc;
    # even do arrays!
    @arr ?= reverse;
    
  4. or download this
    # $foo = 5 if -$foo?
    # $foo = $foo - 5 if $foo - 5?
    $foo ?= - 5;
    
  5. or download this
    $foo{$bar}{$baz} ?= -;