Here is my little piece of code
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
{
package Class;
sub new
{
\treturn bless({});
}
sub DESTROY
{
\tprint "alas, I am undone\\n";
};
}
{
{
\tmy $x = Class->new ();
\tprint "declared\\n";
\t
\tsub IwishItWereIrrelevant
\t{
\t $x;
\t 1;
\t}
}
}
print "out of block\\n";
<<<<<<<<<<<<<<<<<<<<<<
Perl preserves access to functions beyod the function's scope, so $x survives to the end of program. Remove the function, and it will be deleted at the end of block.
And "my sub" is not there to help me. Oh bother!