in reply to Re: unreachable memory with a non-zero reference count
in thread unreachable memory with a non-zero reference count

Your code makes no sense:
...
You overwrite $retVal immediately. Maybe you meant:

The objetc's method does return a string, I need a reference to that string, therefore I overwrite the variable with a reference to it's former value just to not need to declare another variable. I found it more readable than the following, which would work, too: $retVal = \$someObject->bar()->doSomething();
  • Comment on Re^2: unreachable memory with a non-zero reference count

Replies are listed 'Best First'.
Re^3: unreachable memory with a non-zero reference count
by Corion (Patriarch) on Jun 21, 2010 at 13:26 UTC

    But that way you lose the old value. I'm not sure that that's really what you want:

    #!perl -w use strict; use Data::Dumper; my $foo = 'bar'; $foo = \$foo; print $foo; print $$foo; print Dumper $foo; __END__ REF(0x12da554) REF(0x12da554) $VAR1 = \$VAR1;
      But that way you lose the old value. I'm not sure that that's really what you want:
      Of course it isn't. :-) I thought I would be actually using code like in my example and therefore I thought it would be working, but this doesn't seem to be the case. I can't find it anymore, seems I've rewritten it before running into the problem shown and couldnt' remeber anymore. Seems I now have to reasons for don't using things like that, thanks. :-)