I think you've got a bug there; are you sure that the object contains the tasks after your push? That syntax should be
sub addTask {
my( $self, $task ) = @_;
push @{$self->{_tasks}}, $task;
return $task;
}
For what you've written, the line
my @taskArray = @{ $self->{_tasks} }; assigns the content of the array referenced in
$self->{_tasks} to a new array
@taskArray, and this new array is the one that gets the new elements.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.