in reply to Garbage collection

Deleting it from the hash should work by itself. Also, you can call delete without checking existence first.

Where you have to worry about garbage collection is if you have circular object references in the value of the hash:

my $a = { }; my $b = { a => $a }; $a->{b} = $b; $hash{something} = $a; delete $hash{something};
In cases like these, you should break the circular references before the delete.