#!/usr/bin/perl -w use strict; my ($in,$out,$pid); pipe $in, $out or die $!; defined( $pid = fork() ) or die "No fork: ", $!; if ($pid == 0) { # in child close $out; print "From Child: ", $_ while <$in>; exit 0; } # in parent close $in; print $out "From Parent: ", $_ while <>; close $out; wait;