Help for this page

Select Code to Download


  1. or download this
    sub name {
       my $arg = ref $_[0] ? $_[0] : \do{my $anon = $_[0]};
    ...
    
       return $$arg;
    }
    
  2. or download this
    sub name {
       our $arg;
    ...
    
       return $arg;
    }
    
  3. or download this
    $i = $j = 'unchanged';
    name(\$i);
    ...
    $i = $j = 'unchanged';
    $j = name(\$i);
    print("i:$i, j:$j\n");  # i:changed, j:changed
    
  4. or download this
    sub name {
       our $arg;
    ...
    
       return $arg;
    }
    
  5. or download this
    name($i);                                  # In place
    $j = name($i);                             # Not in place
    sub test { name($_[0]) }                   # unknown!!!
    sub test { name($_[0]) }   test($i);       # In place
    sub test { name($_[0]) }   $j = test($i);  # Not in place