I got this working, but only for a single data set.I forgot there was another foreach loop going on in one of the "dostuff" sections which is creating a multi dimensional array.

The problem becomes, how do I return a multidimensional array in its entirety back to the parent?

#pseudo code use Parallel::ForkManager; my @names = (); my %list = (); my %thing = (); $threads = 20 my $pfm = new Parallel::ForkManager( $threads ); $pfm->run_on_finish( sub { my ($pid, $exit_code, $ident, $exit_signal, $core_dump, $data_stru +cture_reference) = @_; my $name = $data_structure_reference->{name}; %list = $data_structure_reference->{data1}; $thing{$name}{a} = $data_structure_reference->{thing1}; $thing{$name}{b} = $data_structure_reference->{thing2}; push @names, $data_structure_reference->{name}; }); }); FOREACH: foreach my $thing(keys %{$things_hr}) { my $pid = $pfm->start and next; #do stuff push @names, $name; #do stuff $thing1{$name}{a} = $value1; $thing{$name}{b} = $value2; #do stuff Foreach $id:{ $list{$id}{$name}{b} = $b; $list{$id}{$name}{e} = $b1; $list{$id}{$name}{a} = 0; $list{$id}{$name}{c} = $ar->[$id][3]; $list{$id}{$name}{i} = $ar->[$id][1]; $list{$id}{$name}{j} = $ar->[$id][2]; $list{$id}{$name}{k} = sprintf("%.4f",$ar->[$id][9]); } $pfm->finish( 0, { data1 => %id, name => $sample_name, thing1 => $value1, thing2 => $value2,}); $pfm->wait_all_children;

In reply to Re^2: Parallel::ForkManager and multiple datasets by Speed_Freak
in thread Parallel::ForkManager and multiple datasets by Speed_Freak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.