in reply to arrays of object in OO perl
Unfortunately, the biggest problem with using references seems to be getting the syntax right. Try thi:
sub getIndividual{ my $this = shift; my $index = shift; return $this->{individual}->[$index]->getDNA(); }
The problem with your version was you were trying to call a method on an array slice.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: arrays of object in OO perl
by IL_MARO (Initiate) on Nov 19, 2008 at 06:34 UTC |