<?xml version="1.0" encoding="windows-1252"?>
<node id="1016089" title="Re: How come undef eq '' ??" created="2013-01-30 10:49:18" updated="2013-01-30 10:49:18">
<type id="11">
note</type>
<author id="708738">
LanX</author>
<data>
<field name="doctext">
For good reasons operators in Perl do type conversions!&lt;P&gt;&lt;P&gt;

&lt;LI&gt; &lt;c&gt;==, + - *  &lt;/c&gt; and so on do &lt;I&gt;numification&lt;/I&gt; so &lt;C&gt;undef&lt;/C&gt; is considered 0&lt;P&gt;&lt;P&gt;

&lt;LI&gt; &lt;C&gt;eq&lt;/C&gt;, &lt;c&gt;.&lt;/c&gt; and so on do &lt;I&gt;stringification&lt;/I&gt; so undef is considered empty string &lt;c&gt;""&lt;/c&gt;.&lt;P&gt;&lt;P&gt;

Anyway using &lt;C&gt;warnings&lt;/C&gt; you'll often get "&lt;c&gt;Use of uninitialized value&lt;/c&gt;" messages.&lt;P&gt;&lt;P&gt;

I do not understand what your intentions are, but if you wanna test for &lt;C&gt;undef&lt;/C&gt; use the designated functions [doc://defined] or &lt;c&gt;//&lt;/c&gt;&lt;P&gt;&lt;P&gt;

&lt;H5&gt; EDIT&lt;P&gt;&lt;/H5&gt;&lt;P&gt;

[doc://perlop#Equality-Operators] in perlop&lt;P&gt;&lt;P&gt;

&lt;pre&gt;
       Binary "==" returns true if the left argument is &lt;B&gt;numerically&lt;/B&gt; equal to
       the right argument.
...
       Binary "eq" returns true if the left argument is &lt;B&gt;stringwise&lt;/B&gt; equal to
       the right argument.
&lt;/pre&gt;&lt;P&gt;&lt;P&gt;



 &lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-708738"&gt;
&lt;p&gt;Cheers Rolf
&lt;/div&gt;&lt;/div&gt;&lt;P&gt;&lt;P&gt;

</field>
<field name="root_node">
1016083</field>
<field name="parent_node">
1016083</field>
</data>
</node>
