Parallel::ForkManager does exactly that. It is clearly documented. What's the problem exactly? Kids share STDOUT/STDERR with parent unless you make it different. Are you trying to do system() in which case you want to use a pipe open, open2, open3, or backtics to fire up the external process in the kids so you can grab the output.....
C:\>type test.pl use Parallel::ForkManager; $|++; # unbuffer output my @collections = qw (col1 col2 col3 col4 col5); my $max_tasks = 3; $pm = new Parallel::ForkManager($max_tasks); for my $collection (@collections) { my $pid = $pm->start and next; # do something with $collection in kid do{print "$_\t$collection\n"; sleep 1 } for 1..2; # kill kid $pm->finish; } C:\>perl test.pl > out C:\>type out 1 col1 1 col2 1 col3 2 col1 2 col2 2 col3 1 col4 1 col5 2 col4 2 col5 C:\>

cheers

tachyon


In reply to Re: Parallel tasks by tachyon
in thread Parallel tasks by john.goor

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.