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.
In reply to Re: arrays of object in OO perl
by gwadej
in thread arrays of object in OO perl
by IL_MARO
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |