<?xml version="1.0" encoding="windows-1252"?>
<node id="1010921" title="Re^3: A more concise way to map the contents of an array." created="2012-12-30 08:55:42" updated="2012-12-30 08:55:42">
<type id="11">
note</type>
<author id="708738">
LanX</author>
<data>
<field name="doctext">
&lt;i&gt; &gt; Regarding your footnote, supposing i didn't need 0 for false, how would i do it? And how else can you represent false? &lt;/i&gt;&lt;P&gt;

Just use the product of a doubled negation to get clear booleans!¹&lt;P&gt;

Perl's definition of false covers different data types and context cases.&lt;P&gt;

from [doc://perldata]&lt;P&gt;

&lt;c&gt;
       A scalar value is interpreted as TRUE in the Boolean sense if it is not
       the null string or the number 0 (or its string equivalent, "0").  The
       Boolean context is just a special kind of scalar context where no
       conversion to a string or a number is ever performed.
&lt;/c&gt;&lt;P&gt;

(Null string here means either empty string &lt;c&gt;""&lt;/c&gt; or &lt;c&gt;undef&lt;/c&gt;)&lt;P&gt;


from [doc://perlsyn]&lt;P&gt;

&lt;c&gt;
Truth and Falsehood
 
       The number 0, the strings '0' and '', the empty list "()", and "undef"
       are all false in a boolean context. All other values are true.
       Negation of a true value by "!" or "not" returns a special false value.
       When evaluated as a string it is treated as '', but as a number, it is
       treated as 0.
&lt;/c&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;

¹) in this case 
 
&lt;c&gt; my @cell_contents = map { !!$_ } @$array_ref[3..10];&lt;/c&gt;&lt;P&gt;

for me the most readable alternative!</field>
<field name="root_node">
1010917</field>
<field name="parent_node">
1010920</field>
</data>
</node>
