Help for this page

Select Code to Download


  1. or download this
    sub DESTROY { print "Destroying $_[0][0]\n"; }
    
    ...
        my $y = bless [ '$y' ];
        $y->[1] = $x;
    }
    
  2. or download this
    Destroying $x
    Destroying $y
    
    Destroying $y
    Destroying $x
    
  3. or download this
    sub DESTROY { print "Destroying $_[0][0]\n"; }
    
    ...
        $l1->[1] = my $l2 = bless [ 'l2' ];
        $l2->[1] = my $l3 = bless [ 'l3' ];
    }
    
  4. or download this
    Destroying l1
    Destroying l2
    ...
    Destroying l1
    Destroying l2
    Destroying l3
    
  5. or download this
    sub DESTROY { print "Destroying $_[0][0]\n"; }
    
    ...
    our $z = bless [ '$z' ];  # pkg var
    
    END { print "Entering global destruction\n" }
    
  6. or download this
    $ perl a.pl
    Destroying $x
    Entering global destruction
    Destroying $z    # Can occur in any order
    Destroying $y    #