http://www.perlmonks.org?node_id=24838


in reply to Ingoring Child Processes And glob()

Instead of messing with $SIG{CHLD}, either For example, the following code waits for any terminated kid:
## first, reap any zombies so child CPU is proper: { my $kid = waitpid(-1, 1); if ($kid > 0) { redo; } }
This comes from my WebTechniques column on logging to a DBI database.

-- Randal L. Schwartz, Perl hacker