defined($pid = open(CHILDPROC, "$cmdargs |")) or die "Can't fork: $!"; while(){ # ... }