note
Abigail-II
<blockquote>
you could pass a 200 line script like this -
though you might find it a pain to write all on one line.
</blockquote>
So, write it on multiple lines. <tt>-e</tt> may be repeated:
<code>
$ perl -wl -e 'print "This is line 1";' \
-e 'print "This is line 2";' \
-e 'print "This is line 3";' \
-e 'print "This is line 4";' \
-e 'print "This is line 5";'
</code>
works like a charm.
<blockquote>
-p (looping plus)
<p>
in longhand it looks like this:
<code>
while(<>) { print ; }
</code>
</blockquote>
Actually, it's a bit more subtle than that, as can be shown by
using the deparser:
<code>
$ perl -MO=Deparse -pe '1'
LINE: while (defined($_ = <ARGV>)) {
'???';
}
continue {
print $_;
}
-e syntax OK
</code>
The print is done in a continue block, so it will print even if you
use <tt>next</tt> in the supplied code. Note also the label.
<blockquote>
-a (split)
<p>
in longhand:
<code>
split;
</code>
</blockquote>
Well, that should be: <code>@F = split;</code>, but it should be
noteworthy that <tt>-a</tt> only works in combination with
<tt>-n</tt> or <tt>-t</tt>.
<blockquote><code>
perl -01512 -e
</code></blockquote>
This is what I get when I run it:
<code>
$ perl -01512 -e 1
Unrecognized switch: -2 (-h will show valid options).
$
</code>
You can only use <tt>-0</tt> to set <tt>$/</tt> to a one character string -
not to set it to <code>\r\n</code>.
<p>
Abigail
324749
324749