Kaluh has asked for the wisdom of the Perl Monks concerning the following question:
package TreeNode; use strict; sub new { my $caller = shift; my $class = ref($caller) || $caller; #the instance data is stored in an anonymous hash my $self = { TreeNodes => '@' # Array of TreeNodes }; bless ($self, $class); return $self; } sub AddNode { my $self = shift; # Create a new instance of TreeNode my $newNode = TreeNode->new(); # Add new instance to Array of TreeNodes push( @{$self->{TreeNodes}}, $newNode ); # This goes wrong! } 1; # so the require or use succeeds
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: array stored in anonymous hash
by revdiablo (Prior) on Mar 02, 2004 at 21:31 UTC | |
|
Re: array stored in anonymous hash
by matija (Priest) on Mar 02, 2004 at 21:21 UTC | |
|
Re: array stored in anonymous hash
by Stevie-O (Friar) on Mar 03, 2004 at 00:32 UTC |