PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
consider this piece of code:
This shows best the current problem I'm facing. I have an interpolated reference within a scalar. If I retrieve it, the ref operator does not recognize it as reference anymore. My question is: a) After such an interpolation happens - is the object the reference is/was pointing to destroyed if this was the last reference (before interpolation). (Only then b makes sense)my @aha = (1,2,3,4,5); my $ref = \@aha; my $ref2="$ref"; print "@$ref\n"; print ref($ref), " $ref\n"; print ref($ref2)," $ref2\n";
b) how could I raise the interpolated reference from the dead so that it would be recognized as a reference (could do with regexp - brrr) and that I can really use it as such.
Quite franky I expect the answer "Your code is broken". :-)
Bye
PetaMem
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Recovering References from Interpolation
by Ovid (Cardinal) on Jun 10, 2002 at 14:31 UTC | |
|
Re: Recovering References from Interpolation
by Joost (Canon) on Jun 10, 2002 at 14:40 UTC | |
|
(jeffa) Re: Recovering References from Interpolation
by jeffa (Bishop) on Jun 10, 2002 at 14:29 UTC | |
|
Re: Recovering References from Interpolation
by vladb (Vicar) on Jun 10, 2002 at 14:29 UTC |