in reply to Fork Me I need help

When a process forks the child gets a copy of the parent's environment, but it's not the same set so adding to the arrays in the child won't affect those in the parent. This is more a task for threading rather than fork'ing, or write your output to a file (With suitable file locking) and when done have the parent read in from there.

Forks are for where you want the child to spin off with minimal contact, threads are where you want shared data and so forth. Personally I tend to stick to fork, this way I don't have to deal with threadsafe code, and use the file technique above.

Another small point, you call the 'next' from the child. This is, I believe, very bad since you don't end up calling $pm->finish which is what I'd replace your next OUTER calls with.

As an added freebie, here's the routine I'm currently using to do the 'adding to a file' bit. I appreciate this isn't particularly wonderous code, but it does seem to work.

# Nice little code fragment to append to the end of a file. # Takes the name of the file to append to, followed by # all of the lines of text to append. sub SafeAppend { my ($file, @content) = @_; s/\n*$/\n/ foreach @content; local *FILE; open FILE, ">>$file" or die "ERROR: Cannot write $file: $!\n"; flock (FILE, LOCK_EX) or die "ERROR: Cannot lock $file: $!\n"; seek (FILE,0,2) or die "ERROR: Cannot seek to end of $file: $!\n"; print FILE foreach @content; close FILE or die "ERROR: Cannot close $file: $!\n"; }