Thank you for the prompt reply. This certainly would work. What I am looking for though is an explanation of why, even though the object can't be accessed (I would assume it is out of scope), the DESTROY method is still not called.
UPDATE:
I notice that the above post mentions the scope is that of the block surrounding the if. If that is true (I don't know if it is or not) why do I get a compile error when I add the following line at the end of my code (assuming that the $obj should still be in scope):
print "[".ref($obj)."]\n";
Any ideas?
my @a=qw(random brilliant braindead); print $a[rand(@a)];