in reply to Recovering References from Interpolation
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:
I believe, the answer would be 'yes' when you are at a point in your code outside of 'Block A'.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";
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..
$"=q;grep;;$,=q"grep";for(`find . -name ".saves*~"`){s;$/;;;/(.*-(\d+) +-.*)$/; $_=["ps -e -o pid | "," $2 | "," -v "," "];`@$_`?{print"+ $1"}:{print" +- $1"}&&`rm $1`; print$\;}
|
|---|