while ( read($fh, $buf, $len) ) { @lines = split "\n", $buf; . . . }