Help for this page

Select Code to Download


  1. or download this
    
    sub another_func {
    ...
      # the 'some_hash' data, but we have created another
      # reference (the return value) so the data lives...
    }
    
  2. or download this
    # Note use of {} (same as for accessing hash elem)
    my $ref_to_anon_hash = { foo => 'bar' };
    # Note use of () (same as for accessing array elem)
    my $ref_to_anon_array = [ 1, 2 ];
    
  3. or download this
    sub leak_mem {
      my $foo;  # foo data has one reference, the 'foo' name
    ...
      # to zero.
      # We just lost some bytes, sir.
    }