On Tue, 12 Jun 2001 00:02:21 -0400, Adam Russell wrote:
> So, ok. I now know how to get a CR in MacPerl. However, why does MacPerl
>convert \r to \n ?
On Unix, "\n" is chr(10) and "\r" chr(13). On MacPerl it's the reverse:
"\n" is chr(13) and "\r" is chr(10). Or, in summary: "\n" is the normal
line ending character, and "\r" is the other one.
Note that on a PC, "\n" is chr(10), which gets converted to
chr(10).chr(13) when printed to a non-binmode()-d file; the chr(13) gets
dropped from every chr(10).chr(13) combination when reading from a
non-binmode()-d file. So internally, PC acts like Unix.
Now, what where you asking? You want chr(13), cross-platform? Then use
"\015" (octal) or "\x0D" (hex). "\015\012" is CRLF on any platform,
while "\r\n" is not, not on a Mac.
Note that if you use literal returns, i.e. "
", in strings, FTP will likely modify these.
--
Bart.