use strict; use warnings; use FileHandle; # Create named pipe... my $pipe = "/tmp/mypipe"; system("ksh -c 'if [ ! -p $pipe ]; then mkfifo $pipe; fi'"); # Setup input process... open(IN, '|-', "cat - > $pipe") || die "Can't open IN process: $!"; IN->autoflush(1); # Setup output process... open(OUT, '-|', "tail -f $pipe") || die "Can't open OUT process: $!"; OUT->autoflush(1); # Send input... my $input = '12345678901234567890123456789012345678901234567890'; print STDERR "Sending input...\n"; print IN $input; # Read output... print "Reading...\n"; my $line; while($line = ) { print $line }