pipe(PIPE_READ,PIPE_WRITE); autoflush PIPE_WRITE 1; my $pid = fork(); if ($pid = fork) { &write_pipe ($pid); waitpid($pid,0); } elsif (defined $pid) { &read_pipe; } else { die "cannot fork: $!"; } sub write_pipe { print "pid $$ \n"; print "Enter message: "; sleep 1; my $usr_msg = <>; print "Parent pid = $$ message = $usr_msg"; print PIPE_WRITE "$usr_msg\n"; } sub read_pipe { print "child pid = $pid"; my $msg_read = ; print "received from pipe $msg_read"; }