use IO::Handle; use Timer::HiRes qw(usleep); print "before the pipe\n"; sub getpipe { my $hash2 = shift; print( "starting yes.pl " . time() . "\n" ); $hash2->{pid} = open( $hash2->{stdout}, "/usr/bin/perl yes.pl |") or die; $hash2->{buffer} = ""; $hash2->{stdout}->blocking(0); sleep( 1 ); return $hash2->{pid}; } my $hash = {}; getpipe($hash); my $fh = $hash->{stdout}; print( "pipe created\n" ); my $count = 0; while( 1 ) { my $data = <$fh>; if( $data != "" ) { print "got from pipe: $data"; } print( "." ); usleep( 10000 ); } print( "done\n" );