my $bytes = sysread($handle,$buf,1024); if ($bytes == 0) {