use POSIX ":sys_wait_h"; ... do { $kid = waitpid(-1, WNOHANG); } until $kid > 0;