SPUG: Order of -00 and -wln matters!

Tim Maher tim at consultix-inc.com
Sun Oct 12 16:21:44 CDT 2003


Anybody ever noticed that the relative order of -00 (for paragraph
mode) and -wln is important?  For example, see the program 
below.  I haven't found any documentation of this behavior,
which makes it seem more like a bug that a feature, although I think
its deliberate. (Tested with 5.8.0).

It seems that the $/ variable (and $\) gets set at the time
-l is encountered in the left-to-right scan of the invocation
options, rather than after all options have been processed (and -00
has a chance to change $/).

$ perl -00 -wln -e 'print' code/memo
This is the file "memo", which
starts with these three lines
spread out like so.

And then it continues to a
second paragraph.

$ perl -wln -00 -e 'print' code/memo
This is the file "memo", which
starts with these three lines
spread out like so.
And then it continues to a
second paragraph.

$

-Tim
*------------------------------------------------------------*
| Tim Maher (206) 781-UNIX  (866) DOC-PERL  (866) DOC-UNIX   |
| tim(AT)Consultix-Inc.Com  TeachMeUnix.Com  TeachMePerl.Com |
*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
|  UNIX Fundamentals Class: 11/10-13   Perl Class: 12/01-05  |
|  Watch for my Book: "Minimal Perl for Shell Programmers"   |
*------------------------------------------------------------*



More information about the spug-list mailing list