#!/usr/bin/perl -w use strict; use IO::Handle; use POSIX qw /mkfifo/; mkfifo "fifo", 0777 unless (-p "fifo"); pipe (PARENTR, SAPW); pipe (SAPR, PARENTW); SAPW->autoflush(1); PARENTW->autoflush(1); my $pid = fork; if ($pid) { close PARENTR; close PARENTW; while (1) { open FIFOR, "fifo"; my $line = ; close FIFOR; print SAPW $line; close SAPW; # don't want this print ; } } else { close SAPR; close SAPW; open STDIN , '<&PARENTR'; open STDOUT, '>&PARENTW'; exec "cat"; die $!; }