My forking children won't listen !!

They have: 3 posts

Joined: Dec 1999

Working on a long running perl script, that I think would be better suited to using fork() than running on it's own.

Basically, the pseudocode for it is something like this:

my @to_do_list

push @to_do_list, $something;

foreach my $item ( @to_do_list ) {

    .. do some work.
    if ( I find something else to do)  {
       push @to_do_list, $this_new_thing;


So, you can see that it's an array that can be added to in mid-stream, and continually grows. Depending on the amount of things "found to do" in the inside loop, it can take hours and hours to run, as that array grows larger.

What I'm wanting to do, is fork off 10 child processes, and have each of them doing the same loop, each aware of the master array's contents, and each able to push things onto it, so that the other children, when they're in the loop see the new todo items...

Can the children intercommunicate?

If not, can they at least return a value back to the parent?
In this case, we could have it fork 10, give them a task, get back the new todo items found, and die. Then, fork 10 new kids, etc ....

Thanks, John