<?xml version="1.0" encoding="windows-1252"?>
<node id="470609" title="Re: Favourite One-liners?" created="2005-06-28 08:54:43" updated="2005-07-02 06:08:41">
<type id="11">
note</type>
<author id="439528">
tlm</author>
<data>
<field name="doctext">
&lt;p&gt;Though it is not the infallible oracle I once thought it was, I still make frequent use of
&lt;c&gt;
% perl -MO=Deparse,-p -e '&lt;Perl code&gt;'
&lt;/c&gt;
...to figure out how perl is parsing something, or maybe to get a grip on some obfu.  E.g. if you wonder what this one-liner does
&lt;c&gt;
-nle '}{print$.' foobar.txt
&lt;/c&gt;
feed it to &lt;tt&gt;-MO=Deparse,-p&lt;/tt&gt; (make sure to retain any other command line switches, like &lt;tt&gt;-nl&lt;/tt&gt; here):
&lt;c&gt;
% perl -MO=Deparse,-p -nle '}{print$.'
BEGIN { $/ = "\n"; $\ = "\n"; }
LINE: while (defined(($_ = &lt;ARGV&gt;))) {
    chomp($_);
}
{
    print($.);
}
-e syntax OK
&lt;/c&gt;
Note that the &lt;tt&gt;-p&lt;/tt&gt; in this one-liner is part not perl's command line switch, but rather an argument to [mod://B::Deparse].
&lt;/p&gt;
&lt;p&gt;Less commonly , I use other backends, such as [mod://B::Terse] and [mod://B::Concise], instead of [mod://B::Deparse].  See also [mod://O] and [mod://B].
&lt;/p&gt;

&lt;p&gt;&lt;small&gt;the lowliest monk&lt;/small&gt;&lt;/p&gt;</field>
<field name="root_node">
470397</field>
<field name="parent_node">
470397</field>
</data>
</node>
