The excitement of running parallel may cause us to forget, ah yes, simply let Perl be Perl. The P::FM documentation provides a scalar example. That is send a scalar ref, de-ref as such in the run_on_finish callback. Ditto for array or hash.
$pm->finish(0,\$scalar); # or
$pm->finish(0,\@array); # or
$pm->finish(0,\%hash);
$pm -> run_on_finish (
sub {
my ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data_
+ref) = @_;
if (defined($data_ref)) {
my $scalar = ${$data_ref}; # or
my @array = @{$data_ref}; # or
my %hash = %{$data_ref};
}
}
);