in reply to Copying under Windows?

0x0a (newline under linux) is getting transliterated to 0x0d/0x0a (carriage return/linefeed) under DOS/Windows.

Try binmode (OUTFILE); after the open.

It has to do with the way various operating systems interpet the character used to indicate an end of line. *nix's have always used a single character, 0x0a (represented by '\n', or the ASCII 'LF' name) to indicate an end of line. DOS/Windows uses a carriage return (symbolized by '\r', or the ASCII 'CR' name), followed by a linefeed (symbolized by '\n', ASCII 'LF'). Macs store it yet another way (I think it's 0x0a then 0x0d, but I'm not versed in Macs).

For more details, see the 'perldoc -f binmode' page.

--Chris

e-mail jcwren

Replies are listed 'Best First'.
(tye)Re: Copying under Windows?
by tye (Sage) on Mar 21, 2001 at 04:56 UTC

    binmode($image_file) as well or you won't be able to read past any CTRL-Zs in the input file.

            - tye (but my friends call me "Tye")
Re: (jcwren) Re: Copying under Windows?
by liupang (Acolyte) on Mar 21, 2001 at 05:20 UTC
    Thx! That was fast... I am reading the documents for binmode right now...