If your subroutines are only ever called once, what gains do you hope to get from parallelizing them?
My approach would be to not store any data but to forward it to whatever subroutine. If you want to do some processing after a subroutine has consumed all data passed to it, do it just there:
sub accumulate { async { my %totals; while (defined (my $payload = $q2->dequeue())) { $totals{ $payload }++; }; # Processing has finished print_to_json(\%totals); }; };
In reply to Re^9: adding a hash to a shared object
by Corion
in thread adding a hash to a shared object
by daverave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |