pipe(my $reader, my $writer); # Create a pipe if (my $pid = fork()) { # In parent: read one line from the pipe and print it print "Message from child: ".<$reader>; } else { # In child: print a line of text to the pipe print $writer ("Hello, parent!\n"); }