<?xml version="1.0" encoding="windows-1252"?>
<node id="1006557" title="Re: Illogical logic statement" created="2012-11-30 21:32:23" updated="2012-11-30 21:32:23">
<type id="11">
note</type>
<author id="968231">
Athanasius</author>
<data>
<field name="doctext">
&lt;p&gt;Hello [fkento], and welcome to the Monastery!&lt;/p&gt;

&lt;p&gt;From [doc://perlsyn#Truth-and-Falsehood]:&lt;/p&gt;

&lt;blockquote&gt;
The number 0, the strings &lt;tt&gt;'0'&lt;/tt&gt; and &lt;tt&gt;""&lt;/tt&gt;, the empty list &lt;tt&gt;()&lt;/tt&gt;, and &lt;tt&gt;undef&lt;/tt&gt; are all false in a boolean context. All other values are true.
&lt;/blockquote&gt;

&lt;p&gt;So, since the &lt;i&gt;string&lt;/i&gt; &amp;ldquo;&lt;tt&gt;false&lt;/tt&gt;&amp;rdquo; is none of 0, &lt;tt&gt;'0'&lt;/tt&gt;, the empty string, the empty list, or &lt;tt&gt;undef&lt;/tt&gt;, it is true in Perl.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Update:&lt;/b&gt; Sorry, misread the question. The answer lies in the distinction between the operators &lt;tt&gt;==&lt;/tt&gt; and &lt;tt&gt;eq&lt;/tt&gt;. The former is for numerical comparison, the latter for string equality. See [doc://perlop#Equality-Operators].&lt;/p&gt;

&lt;code&gt;
12:43 &gt;perl -E "say (('false' == 'true') ? 'same' : 'different');"
same

12:43 &gt;perl -E "say (('false' eq 'true') ? 'same' : 'different');"
different

12:43 &gt;
&lt;/code&gt;

&lt;p&gt;Hope that helps,&lt;/p&gt;

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-968231"&gt;
&lt;p&gt;Athanasius&amp;emsp;&lt;font color=#008000&gt;&amp;lt;&amp;deg;(((&amp;gt;&amp;lt;&lt;/font&gt;&amp;emsp;&lt;i&gt;contra mundum&lt;/i&gt;&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1006555</field>
<field name="parent_node">
1006555</field>
</data>
</node>
