if ($pid[$i]=fork()) { # parent process waitpid($pid[$i], 0); # wait for child close ($wh); ...