hsweet has asked for the wisdom of the Perl Monks concerning the following question:
Thanks for the help on my last question Adventure Game ->object. I've figured out how to oop-a-fy my once procedural script
Except for one bit. Each object this class creates needs to keep track of a list of related things.. therefore the anonymous array, $self->{'things'} = ;
How do you put things into and display the array via a method?
sub new{ my ($class,$player ) = @_; my $self = {}; bless $self, $class; $self->{'things'} = [ ]; return $self; }
Time flies like an arrow, fruit flies like banannas
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Filling object arrays
by djantzen (Priest) on May 20, 2003 at 01:34 UTC |