<?xml version="1.0" encoding="windows-1252"?>
<node id="985228" title="Re: Difference in accessing a Hash" created="2012-08-03 09:03:58" updated="2012-08-03 09:03:58">
<type id="11">
note</type>
<author id="616540">
moritz</author>
<data>
<field name="doctext">
&lt;c&gt;$a{b}&lt;/c&gt; accesses the hash &lt;c&gt;%a&lt;/c&gt;, which has no relation to the variable &lt;c&gt;$a&lt;/c&gt;. &lt;c&gt;$a-&gt;{b}&lt;/c&gt; assumes that &lt;c&gt;$a&lt;/c&gt; is a hash reference, and accesses the element &lt;c&gt;b&lt;/c&gt; of it.

&lt;p&gt;Always &lt;c&gt;use strict&lt;/c&gt;, it will catch such errors if you happen to write the wrong one (and the other one isn't declared).

&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-616540"&gt;
[http://perl6.org/|Perl 6 - the future is here, just unevenly distributed]
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
985226</field>
<field name="parent_node">
985226</field>
</data>
</node>
