in reply to Question regarding perl memory management

AFAIK and if I understand your question, the memory allocated to this variable won't be 'trashed' if there remains reference of any kind to this memory block.
I mean as long as you got a reference to a variable (whatever the type hash,array,scalar) you will be able to access it via this reference...
my $ref; { my $foo=10; $ref=\$foo; print "foo=$foo\n"; print "ref=$ref ($$ref)\n"; } print "foo=$foo\n"; print "ref=$ref ($$ref)\n";

will produce:
foo=10 ref=SCALAR(0x80f14ec) (10) foo= ref=SCALAR(0x80f14ec) (10)