Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have one class:
and another class:package Node use strict; my ($id, $u, $p, $log, @mess); sub New { my $class =shift; my $this ={}; @mess =(); $log =0; bless ($this, $class); return ($this); }
Which produces this: Not a HASH reference at System.pm line 62, <STDIN> line 6. Please help me see why I cannot defrefrence this object in the array of objects called @nodes. Sincerely, Lostpackage System; use strict; my (@nodes, $n1, $server, @messages); ... sub ANodeLogin{ my $self =shift; use Node; my $node=Node->New; push (@nodes, \$node); ... sub ANodeLogout{ my $self =shift; my $node; print "What node would you like to log out of\n"; foreach $node (@nodes){ print "--->$node->{u}<---\n";#this is line 62 } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: derefrencing an object
by Thelonius (Priest) on May 03, 2004 at 17:01 UTC | |
by Anonymous Monk on May 03, 2004 at 17:04 UTC | |
by Thelonius (Priest) on May 03, 2004 at 17:46 UTC | |
by sgifford (Prior) on May 03, 2004 at 17:48 UTC |