open my $pipe, "| cat" or die $!; my $pid = fork(); if( $pid == 0 ) { # child print $pipe "Child\n"; exit 0; } sleep 1; print $pipe "Parent\n"; my $reaped = waitpid(-1, 0 ); print "pid $reaped\n";