<?xml version="1.0" encoding="windows-1252"?>
<node id="999732" title="Re: Rook question" created="2012-10-18 09:21:08" updated="2012-10-18 09:21:08">
<type id="11">
note</type>
<author id="647953">
sundialsvc4</author>
<data>
<field name="doctext">
&lt;p&gt;
One of the trickiest notions in Perl is the issue of &lt;em&gt;contexts.&lt;/em&gt; &amp;nbsp; When you wrote &lt;tt&gt;&lt;b&gt;$&lt;/b&gt;sum += &lt;b&gt;@&lt;/b&gt;_&lt;/tt&gt;, you used an &lt;b&gt;@&lt;/b&gt;array value in a &lt;b&gt;$&lt;/b&gt;scalar context. &amp;nbsp; That changes what it does.
&lt;/p&gt;&lt;p&gt;
For debugging such things, I would insert a statement within the loop that prints useful information to the STDERR file, e.g.:&lt;br/&gt; &amp;nbsp; &lt;tt&gt;print STDERR "sum is $sum\n";&lt;/tt&gt;.
&lt;/p&gt;&lt;p&gt;
All interactive programs have two output streams, &lt;tt&gt;STDOUT&lt;/tt&gt; and &lt;tt&gt;STDERR&lt;/tt&gt;, the latter intended for error or diagnostic outputs.
&lt;/p&gt;&lt;p&gt;
Also, get used to &lt;em&gt;now&lt;/em&gt; putting these two statements at the start of every program: &lt;br/&gt;&lt;tt&gt;&amp;nbsp; use strict; &lt;br/&gt;&amp;nbsp; use warnings;&lt;/tt&gt;
&lt;/p&gt;

</field>
<field name="root_node">
999655</field>
<field name="parent_node">
999655</field>
</data>
</node>
