in reply to parent wants to capture output from a spawned child

The answers to forking: retaining variables after the child exits still apply. I'd go with pipe, if I were you.

You can also safely whack the "set default values of HoH", because it's not doing anything, useful or otherwise. Hash keys automagically spring into existence when you need them (in your child processing code). Besides that, you're creating a new anonymous hash for the lexical $domatch on each iteration of the inner loop. It doesn't touch the $domatch you've defined outside the loop. That's lucky. If it did, it would overwrite it on each iteration. Of course, hash autovivification saves you from that trouble later on.

It looks like you have a structured programming background (probably C, but something of that family). The second section of perlport has lots of good information that can help you out, if you're interested.

  • Comment on Re: parent wants to capture output from a spawned child