in reply to Re: arrays of object in OO perl
in thread arrays of object in OO perl
sub init { my $i; foreach $i (0 .. 4) { my $this = shift; my $empl = Animal->new(); $empl->setDNA(4, 6, 8, 10); push (@{$this->{individual}}, $empl); print " ".$i."\n"; print $this->{individual}->[$i]->getDNA(); } }
And thus definitively I don't have and array of Animal, but individual is just a scalar. Damn.0 4 6 8 10 1 Can't call method getDNA ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: arrays of object in OO perl
by ChOas (Curate) on Nov 19, 2008 at 07:50 UTC | |
by IL_MARO (Initiate) on Nov 19, 2008 at 07:57 UTC |