if (open(TO, "|-")) { print TO $fromparent; } else { $tochild = ; #Do whatever with $child exit; };