#! perl -sw use strict; use IO::Handle; pipe(FROM_CHILD, TO_PARENT) or die $!; TO_PARENT->autoflush(1); if( my $pid = fork ) { #parent while( ) { chomp; print "\rChild is processing line:$_ "; } print 'Child appears to be finished.'; ## This never reached? close FROM_CHILD; } else { for (1..10) { print TO_PARENT __LINE__, $/; select undef, undef, undef, 0.05; print TO_PARENT __LINE__, $/; select undef, undef, undef, 0.05; print TO_PARENT __LINE__, $/; select undef, undef, undef, 0.05; print TO_PARENT __LINE__, $/; select undef, undef, undef, 0.05; } close TO_PARENT; }