I was using a broken operating system (windows), sorry I failed to mention that. Your binmode worked (thanks), as well as trying the same thing in Linux (without binmode).
Once again thanks for everyone's quick responses.
Just an FYI on Linux and other OS that do not have binary and text mode for files binmode will be optimised out at compile time, so there is no performance or compatability loss from including it.