I was hoping somebody could shed a little light on this:
Most of us just use \n in our code when we want a line break. But, \n actually inserts the native line break code for your OS, instead of a literal Line Feed, so that on Windows, a \n is actually a "\r\n".
Which brings up another subject: isn't explicitely writing \r\n redundant then, on a Windows machine? Because, "\r\n" would literally turn into "\r\r\n"
Or, should we start getting into the habit of using the hex escapes? i.e. using \x0a for line feeds and \x0d for carriage returns?
In my Tk::HyperText module, for instance, it always inserts \x0a into the text box when it wants a new line (because Linux's Perl Tk would show a carriage return as \x{d} in the text box).
So, the question: should we be using \n or \x0a? And should be stop using \r\n because we know it's redundant, and instead use \x0d\x0a?
-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog
Most of us just use \n in our code when we want a line break. But, \n actually inserts the native line break code for your OS, instead of a literal Line Feed, so that on Windows, a \n is actually a "\r\n".
Which brings up another subject: isn't explicitely writing \r\n redundant then, on a Windows machine? Because, "\r\n" would literally turn into "\r\r\n"
Or, should we start getting into the habit of using the hex escapes? i.e. using \x0a for line feeds and \x0d for carriage returns?
In my Tk::HyperText module, for instance, it always inserts \x0a into the text box when it wants a new line (because Linux's Perl Tk would show a carriage return as \x{d} in the text box).
So, the question: should we be using \n or \x0a? And should be stop using \r\n because we know it's redundant, and instead use \x0d\x0a?
-------------
Cuvou.com | My personal homepage
Project Fearless | My web blog