<?xml version="1.0" encoding="windows-1252"?>
<node id="244298" title="Re: Re: Re: Hash of hashes syntax" created="2003-03-19 04:24:59" updated="2005-07-27 05:19:36">
<type id="11">
note</type>
<author id="34691">
Chmrr</author>
<data>
<field name="doctext">
&lt;p&gt;Good eye, but this actually isn't a problem in this case.  Because of the &lt;code&gt;my %h&lt;/code&gt; inside of the loop, %h is a different (and new) lexical through each iteration -- thus there is no problem just sticking a reference to it into the hash or array.  The problem comes from code like this (nearly directly copied from [http://perldoc.com/perl5.8.0/pod/perldsc.html|perldsc]):&lt;/p&gt;
&lt;code&gt;my %hash;
for $i (1..10) {
  %hash = somefunc($i);
  $hash_of_hashes{$rn} = \%hash;     # WRONG!
}&lt;/code&gt;
&lt;p&gt;Note where the "my" is.  See [http://perldoc.com/perl5.8.0/pod/perldsc.html|perldsc] or [http://perldoc.com/perl5.8.0/pod/perlreftut.html|perlreftut] or [http://perldoc.com/perl5.8.0/pod/perllol|perllol] for more.&lt;/p&gt;

&lt;p&gt;perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&amp;V"+@( NO CARRIER'&lt;/p&gt;</field>
<field name="root_node">
244265</field>
<field name="parent_node">
244284</field>
</data>
</node>
