pipe B,A; my $child = fork; die "fork: $!" unless defined $child; if ($child != 0) { use IO::Handle; close B; print A "hello\n"; A->flush; sleep 1; print A "world\n"; exit; } close A; while () { print; }