pipe(README, WRITEME); if (fork) { #parent code while () { # you can do other stuff in here besides reading $output .= $_; } close(README); } else { # child code print WRITEME "interesting stuff"; close(WRITEME); }