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