Note that $SIG{CHLD}= sub {wait}; has another problem. If two children exit at nearly the same time, the two SIGCHLD signals can arrive close enough together that the signal handler only gets called once. Each time this happens, you'd get one more zombie hanging around.
Back to the original problem, I'd add some debug print statements so that you can figure out exactly where the process is hanging.
Also, $SIG{CHLD}= 'IGNORE'; only works on some operating systems (SysV-based ones, as I recall).
-
tye
(but my friends call me "Tye")