At 03:56 AM 6/24/05 -0700, $Bill Luebkert wrote: >Why - either you want the translation (DOS text mode) or you don't >(binary mode). Why bother to ever in your program deal with a CR/\r ? >Let the translation do it for you.
When ur troubleshooting, u want to eliminate as much implicitness as possible. For daily use, yes, let the OS handle it. >That's double-speak. We're not talking about a *virtual* newline >character, we're talking that actual ^J/LF/0x0A/\n character and >yes it is a character and no it isn't virtual. Just a plain old >physical LF/newline character. I think ur missing the point. Let me try a different way. Within the black box fuzzy cloud that is perl, there is a placeholder for the new line sequence which is "\n". Like a quantum particle that has no definate position or velocity until u try to measure it. When we "do something" with \n it "turns into" some bytes that make sense for the current context. The default thing for it to turn into is ^J. It's so common that we just think of them as being synonymous. But it can turn into ^M^J or even just ^M. Beyond that we're arguing over C code and perl source. I don't care that much. If we want to talk strict ASCII, there is by definition no such thing as a newline character. To make a "new line" we have to reset the cursor position to 0 (carriage return ^M) and increment the line count by 1 (line feed ^J). You can say that this is just because of the terminal, well ur right. There's no such thing as a "line" or a "new line" except in the context of a terminal device. Internally there's nothing but bitstreams. It's just a space saving (laziness) convention to omit one of the bytes in the new line sequence. It actually makes a little sense when ur 40 MB harddrive costs $500 and you have a 110 baud teletype. The fallout of that is we now have an implicit construct for making "new lines" that not everyone agrees on. >Proof - Perl script: > >$_ = "1234567890\n"; >dumpit ($_); # dumpit does a hex/character dump of a vrbl to STDOUT Because in that context \n degenerates into ^J. >:) >But if you really wanted a DOSish file on UNIX, you would be correct >in doing what you are doing - just can't think of a reason to do it. :) Some programs (especially notepad) can't handle anything but CRLF. >Let's not get into the stupidity of the MAC line ending. That's kinda >like asking Windoze builders why they chose to use \ instead of / as a >path separator - one of the dumbest design moves in history. Let's not get into the stupidity of the MAC line ending. That's kinda like asking Unix builders why they chose to use / instead of \ as a path separator - one of the dumbest design moves in history. Heh, we're talking ~1979 here. There was nothing but random fog back then. I think we've had enough nerdish computer scientistish speak for one day. -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede males" 00000100 _______________________________________________ Perl-Win32-Users mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
