in reply to Recovering References from Interpolation

You ask,

After such an interpolation happens - is the object the reference is/was pointing to destroyed if this was the last reference.

In your particular code, the answer would be now as $ref variable that also stores the reference is still 'effective' or within the scope. However, if you had something like this:

my $ref2; { # Block A my @aha = (1,2,3,4,5); my $ref = \@aha; $ref2="$ref"; } print "@$ref\n"; print ref($ref), " $ref\n"; print ref($ref2)," $ref2\n";
I believe, the answer would be 'yes' when you are at a point in your code outside of 'Block A'.

UPDATE: Regarding your second question (B), you could try using Devel::Pointer to fiddle around with your 'stringified' references and bring them back to 'life'. Try this code, for example (warning: I haven't tested this...):
use Devel::Pointer; my @aha = (1,2,3,4,5); my $ref = \@aha; my $ref2 = "$ref"; my ($addr) = ($ref2 =~ m/\(\0\x(\d+)\)/); $real_ref = deref($addr); # $real_ref must now point to the @aha array..


UPDATE 1: In addition to Devel::Pointer, there's this PeekPoke module that you might also find interesting. Basically, it allows you to peek a value stored at a given address. Of course, due to the nature of Perl variables (arrays specifically), I wouldn't advice this method for actually accessing individual array's elements. Unlike in C where each array's element could be easily accessed via a pointer (or address peek), Perl arrays is a bit more involved structure, and the address you get with \@array isn't pointing to the first array element but rather the beginning of the Perl structure representing the array. ..

_____________________
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print" +- $1"}&&`rm $1`; print$\;}