<?xml version="1.0" encoding="windows-1252"?>
<node id="324858" title="Re: Uncommon* but Useful Perl Command Line Options (for one-liners)" created="2004-01-28 20:51:44" updated="2005-06-26 14:26:57">
<type id="11">
note</type>
<author id="299049">
ysth</author>
<data>
<field name="doctext">
&lt;blockquote&gt;&lt;i&gt;so dealing with files originating from other OS needs the ability to change the value of \n&lt;/i&gt;&lt;/blockquote&gt;

I would say "to change the value of $/".  -0 certainly doesn't change \n.
&lt;p&gt;
There are also some funky details about how -0 works.
First of all, -0&amp;#91;octal&amp;#93; is limited to 3 following octal digits.  Anything beyond that is interpreted as a new bundled switch (e.g. -07770 is equivalent to -0777 -0 (which is equivalent to just -0)).
&lt;p&gt;
-0 with no following octal digits will set $/ to "\0", the null character.  As you say, -00 does paragraph mode ($/ = "") instead.  This applies to -000 and -0000 also; as above, -00000 etc is interpreted as two separate switches where the first is meaningless, creating the pleasant cycle:
&lt;table&gt;&lt;tr&gt;&lt;th&gt;switch&lt;th&gt;effect
&lt;tr&gt;&lt;td&gt;-0&lt;td&gt;\0 record separator
&lt;tr&gt;&lt;td&gt;-00&lt;td&gt;paragraph mode
&lt;tr&gt;&lt;td&gt;-000&lt;td&gt;paragraph mode
&lt;tr&gt;&lt;td&gt;-0000&lt;td&gt;paragraph mode
&lt;tr&gt;&lt;td&gt;-00000&lt;td&gt;\0 record separator
&lt;tr&gt;&lt;td&gt;-000000&lt;td&gt;paragraph mode
&lt;tr&gt;&lt;td&gt;-0000000&lt;td&gt;paragraph mode
&lt;tr&gt;&lt;td&gt;-00000000&lt;td&gt;paragraph mode
&lt;tr&gt;&lt;td&gt;-000000000&lt;td&gt;\0 record separator
&lt;tr&gt;&lt;td&gt;-0000000000&lt;td&gt;paragraph mode&lt;/table&gt;
&lt;p&gt;
Not just -0777, but any attempt to specify an octal character greater than 0377 (255 decimal), will trigger
slurp mode.
&lt;p&gt;
And starting with 5.8.1, -0 will allow hex characters to be specified like -0x1ff (but you can't bundle it with other switches like -0x1ffw; for backward compatibility, that is interpreted as -0 -x1ffw instead of -0x1ff -w (see perlrun for details on the -x switch)).  Any number of hexidecimal digits are permitted, but only the low 32-bits are used.  This allows specifying any unicode character as the record separator.  Paragraph mode or slurp mode cannot be specified with -0x; -0x0 sets $/ to "\0", not "", -0x1ff (the "equivalent" of -0777) sets $/ to "\x{1ff}", not undef.
&lt;p&gt;
-0x actually allows an extra "x" or "0x" after the first one (e.g. -0x0x0d or -0xx0); this can be construed as a bug.</field>
<field name="root_node">
324749</field>
<field name="parent_node">
324749</field>
</data>
</node>
