my $len = "0"; while ($len eq "0"){ $len = sysread(Serial, $buf, 1 ); }