in reply to Missing bytes??

You are reading from the file in two locations:

while (<FILE>) { ... read(FILE, $buf, 1);

More likely you want while (! eof FILE) { instead of reading a line from FILE and then reading another byte from FILE.

Replies are listed 'Best First'.
Re^2: Missing bytes??
by ikegami (Patriarch) on Apr 06, 2008 at 16:22 UTC
    or
    while (read(FILE, $buf, 1)) { ... }
Re^2: Missing bytes??
by stevee (Acolyte) on Apr 06, 2008 at 15:40 UTC
    Thanks Corion, trying it now. Sadly I did not realise that while (<FILE>) read the file too!
      interesting, what did you think ?