ah, binmode fixed it. d'oh. I never thought you had to use that under non-windows OSes, but I suppose it's a good habit to be in anyway.