sub DESTROY { print "Destroying $_[0][0]\n"; } { my $x = bless [ '$x' ]; my $y = bless [ '$y' ]; $x->[1] = $y; } print("\n"); { my $x = bless [ '$x' ]; my $y = bless [ '$y' ]; $y->[1] = $x; } #### Destroying $x Destroying $y Destroying $y Destroying $x #### sub DESTROY { print "Destroying $_[0][0]\n"; } { my $l3 = bless [ 'l3' ]; my $l2 = bless [ 'l2', $l3 ]; my $l1 = bless [ 'l1', $l2 ]; } print("\n"); { my $l1 = bless [ 'l1' ]; $l1->[1] = my $l2 = bless [ 'l2' ]; $l2->[1] = my $l3 = bless [ 'l3' ]; } #### Destroying l1 Destroying l2 Destroying l3 Destroying l1 Destroying l2 Destroying l3 #### sub DESTROY { print "Destroying $_[0][0]\n"; } my $x = bless [ '$x' ]; my $y = bless [ '$y' ]; $y->[1] = $y; # cycle our $z = bless [ '$z' ]; # pkg var END { print "Entering global destruction\n" } #### $ perl a.pl Destroying $x Entering global destruction Destroying $z # Can occur in any order Destroying $y #