while ($bytes_read) { my $buf; $bytes_read = sysread($out, $buf, $blocksize); ...
Your code leaves the loop as soon as there is nothing to read on a socket.
while( <$fh> ) will read things until it encounters a newline.
In reply to Re: use sysread to read non-blocking filehandle
by Corion
in thread use sysread to read non-blocking filehandle
by x12345
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |