my $maxProcesses=2; my $pm = Parallel::ForkManager->new($maxProcesses, $tempDir); # This has to be declared first. $pm->run_on_finish( sub { my ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data_structure_reference) = @_; my $reftype = ref($data_structure_reference); $log->info(qq/PID:$pid,EXIT_CODE=$exit_code,IDENT=$ident,EXIT_SIGNAL=$exit_signal,CORE_DUMP=$core_dump,DATA=$data_structure_reference(REF_TYPE=$reftype)/); if (defined($data_structure_reference)) { # children are not forced to send anything my $string = ${$data_structure_reference}; # child passed a string reference print "$string\n"; } else { # problems occuring during storage or retrieval will throw a warning print qq|No message received from child process $pid!\n|; } } # End sub );