I don't make a distinction between "newline" and "linefeed"
And that's the crux of problem. There is a distinction to be made. Not making it just hinders understanding.
On all ASCII systems it is ASCII line feed, except for old Macs where they chose to be "lazy" and try to avoid binmode by defining "\n" in C incorrectly.
There is nothing "incorrect" about defining "\n" as CR with regard to the C standard. Perhaps the C standard should dictate that, if your execution character set is ASCII, then "\n" must map to ASCII LF. If you want to argue that, fine; I don't think I'm well-versed enough in the issues to agree or disagree with such an argument.
I think your comment about choosing 'to be "lazy" and try[ing] to avoid binmode' is way off the mark though. Apparently they didn't choose to be lazy enough and do it like the existing (virtuously) "lazy" ASCII systems out there already happily avoiding binmode. If they had they could have stood with everyone else, sniggering and pointing their fingers at CP/M, OS/2, and DOS.
Thank heavens for POSIX. Now, if we could just get rid of Windows once and for all we could rid ourselves altogether of that stupid "b" in our fopen()s.
"newline character"?? There is no such thing. (:
There isn't in ASCII. There is, on the other hand, in C. It is implementation dependent but always fits in a char and it is represented by the escape sequence '\n'.
Then find a non-ASCII system with Perl on it and open a socket from it to some SMTP server on the internet and send "HELO\015\012" to it and tell me if it works.
While I understand the issue you are pointing out, I don't actually work on non-ASCII systems and don't know whether this is a real problem in practice. Certainly it must have been very well addressed by now? I also fail to see how this is at all specific to Perl. You'd have the same issue if you were, say, writing an MTA in C. Right? ASCII is the lingua franca of the network. If you happen to be working on some EBCDIC variation, you've got to learn to adapt. It's like the byte order issue but at a different level.
I guess I can't disagree that perlport is broken for suggesting that using "\015\012" is a good idea without mentioning any caveats for non-ASCII systems. Have you submitted a doc patch? It seems a simple additional note would suffice.
For whatever it's worth though, perlport hasn't muddled my thinking at all.
In reply to Re^7: sprintf is printing unexepected output (newline)
by sauoq
in thread sprintf is printing unexepected output
by thezip
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |