use IO::Handle; print "before the pipe\n"; sub getpipe { my $hash2 = shift; $hash2->{pid} = open( $hash2->{stdout}, "c:\\perl\\bin\\perl.exe yes.pl |") or die; $hash2->{buffer} = ""; $hash2->{stdout}->blocking(0); sleep( 3 ); return $hash2->{pid}; } my $hash = {}; getpipe($hash); my $fh = $hash->{stdout}; print( "pipe created\n" ); while( <$fh> ) { print "got from pipe: $_"; sleep( 1 ); } print( "done\n" );