in reply to Re: Multithreading
in thread Multithreading

What works even better, is to have the children write to one file, but use an excluse lock. Then the parent can sort the file if you need to.

Another option, is to have the children write back to the parent.

my $pid = open ($handle, "-|"); if ($pid){ my $return = <$handle>; close $handle; # Do something with the return value } else { # Do something interesting print $handle "Something interesting"; close $handle; exit; }
Note, I'm on a windows box so I wasn't able to test the above code, but it should be close. Now for mulitple children you'll need to use IO::Select.