On Feb 22, 2006, at 18:52, Luke, David wrote:

Depending upon the OS your Perl script is running under,

$a = index($state, "/\n");

will match Hex 2F 0A or Hex 2F 0D 0A.

Since the meaning of that "match" is a bit ambiguous to me, let me be maybe a bit redundant to be sure the OP gets this right and clear: length "\n" is == 1 always. Everywhere. No matter the OS newline convention. "\n" is eq "\012" in all supported platforms except in MacPerl (pre-OSX), where it is eq "\015".

In text mode the I/O subsytem is responsible of transforming native newlines up to "\n" while reading, and "\n" down to native newlines while writing. That is transparent to the programmer but is the key to understand problems when line-oriented programs deal with text that does not follow the conventions of the runtime platform.

-- fxn



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to