in reply to Re: Re: derefrencing an object
in thread derefrencing an object
use strict; use warnings; System::ANodeLogin(); System::ANodeLogin(); System::ANodeLogin(); System::ANodeLogin(); System::ANodeLogout(); package Node; use strict; my ($id, $u, $p, $log, @mess); sub New { my $class =shift; my $this ={}; $this->{u} = $id++; @mess =(); $log =0; bless ($this, $class); return ($this); } package System; use strict; my (@nodes, $n1, $server, @messages); sub ANodeLogin{ my $self =shift; 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 } }
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.
|
|---|