in reply to derefrencing an object

It looks like this line:
push (@nodes, \$node);
is pushing a reference to a scalar. This scalar happens to be a reference to a hash. So you don't have a reference to a hash in line 62, you have a reference to a reference to a hash. Probably what you want to do is:
push (@nodes, $node);

Replies are listed 'Best First'.
Re: Re: derefrencing an object
by Anonymous Monk on May 03, 2004 at 17:04 UTC
    I made the change and I still get the same error. Could it be b/c I use my $node in ANodeLogin and once I leave that methode $node evaporates? thanks for your help!
      Could it be b/c I use my $node in ANodeLogin and once I leave that methode $node evaporates?

      That shouldn't be a problem. The object should still exist as long as there's a reference to it. It's hard to say what's wrong looking at just these few lines. What I would probably try next is to add:

      use Data::Dumper; print Dumper($node);
      right before line 62.

      Update: Given what sgifford says below, I would suspect either (1) you have another code path which adds to @nodes, or (2) you didn't change the code you were running. In fact, one reason I suggested adding the print Dumper statement was to make sure that you were changing (and saving) the right code. Don't feel too bad if this happens to you. I have to be on the guard against this all the time; it has happened to me too many times over the years. Given how Perl can search many places for a module, that I have two different versions of Perl on my PC, that I often edit on a different system from the one I run on, that there are development, test, and production environments, etc., etc. you have to keep on your toes. Eternal vigilance!

      This fix works for me. I'm running this program: and it outputs:
      What node would you like to log out of
      --->0<---
      --->1<---
      --->2<---
      --->3<---
      
      Without the fix from Thelonius, I get the error you were seeing.

      Maybe the problem is being introduced elsewhere in your program.