in reply to Re^5: is there a way to ensure some code is the last thing that is run?
in thread is there a way to ensure some code is the last thing that is run?

> What's surprising me is that it already works without curlies. I expected the variable to be accessible in END, like in BEGIN.

Interesting Perl get's it right, when needed.

package Blubb; sub new { my $this = bless {a=>42}; # $this->{circular} = $this; } sub DESTROY { warn "DESTROY\n"; } package MAIN; my $b = Blubb->new; END { warn $b->{a}; warn "END\n"; }

42 at c:/tmp/pm/destruct_end.pl line 20. END DESTROY

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!