use Proc::Fork; use IO::Pipe; my ($pipe) = new IO::Pipe; child { $pipe->reader(); while (1) { while ($num = <$pipe>) { } print "Child: $num\n" if $old_num != $num; $old_num = $num; last if $num == 644; } exit; }; $pipe->writer(); while (1) { $in = <>; chomp $in; print $pipe $in; last if $in == 644; }