use POSIX qw/:sys_wait_h/; ... waitpid($pid_c, WNOHANG); # poll whether process has terminated