<?xml version="1.0" encoding="windows-1252"?>
<node id="568459" title="Re: What I Most Recently Learned in Perl, But Should Have Already Known" created="2006-08-20 22:37:56" updated="2006-08-20 18:37:56">
<type id="11">
note</type>
<author id="502468">
imp</author>
<data>
<field name="doctext">
I recently learned how to find out what Perl thinks I mean by my code. The magic of [cpan://B::Deparse].
This answered some mysteries, for example why this code will not stop on values that are seen as false:
&lt;code&gt;
while (&lt;&gt;) {
}
&lt;/code&gt;

When writing that loop explicitly I would be testing it like this:
&lt;code&gt;
while (defined( my $line = &lt;&gt;)) {
}
&lt;/code&gt;

It turns out that is exactly what perl is doing as well, as seen below:
&lt;code&gt;
perl -MO=Deparse -e 'while (&lt;&gt;) {}'
while (defined($_ = &lt;ARGV&gt;)) {
    ();
}
&lt;/code&gt;

It's also interesting to see what the parser thinks about other code, such as:
&lt;code&gt;
perl -MO=Deparse -e ' if(1) {print "true"}'     
do {
    print 'true'
};
&lt;/code&gt;

And
&lt;code&gt;
perl -MO=Deparse -e ' print "true" if 1'   
print 'true';
&lt;/code&gt;

And it is useful for seeing what some of the code from the Obfuscation section is actually doing.
</field>
<field name="root_node">
567774</field>
<field name="parent_node">
567774</field>
</data>
</node>
