I'm using a hash whose keys store object references. Can I simply delete that key or do I need to undef the object reference to make sure the objects are garbage collected? The hash stays in scope but the object was declared lexically scoped earlier in a subroutine and assigned to the value of a hash:
Is there anything that I would need to specifically undef before deleting such a key? Are there other issues here, or am I just confused?use Foo::Object; my %hash = (); &somesub; # does this garbage collect the object? delete $hash{'object'} if exists $hash{'object'} sub somesub { $hash{'object'}=new Foo::Object; }
Thanks.
Edit by tye
In reply to Garbage collection by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |