<?xml version="1.0" encoding="windows-1252"?>
<node id="1015340" title="Re: Can I create hash dynamically by looping through an array? The hash name should be the array element" created="2013-01-25 07:51:59" updated="2013-01-25 07:51:59">
<type id="11">
note</type>
<author id="832495">
choroba</author>
<data>
<field name="doctext">
Yes, you can - if you are not using [doc://strict] refs:
&lt;c&gt;
for my $element (qw/var1 var2 var3/) {
    %$element = ( a =&gt; 'b');
}
print $var1{a};
&lt;/c&gt;
The common practice, though, is to use one hash instead, making the elements of the list the keys. You can then shorten the creation to
&lt;c&gt;
my @array = qw(var1 var2 var3);
my %hash;
undef @hash{@array};
&lt;/c&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-832495"&gt;

&amp;#1604;&amp;#1405;&amp;#4285;† &amp;#6514;&amp;#6482;&amp;#9898;&amp;#10186;&amp;#4281;&amp;#5651;&amp;#5511; &amp;#5045;&amp;#5651;&amp;#5511;&amp;#9137; &amp;#4281;&amp;#6514;&amp;#119243;&amp;#409;&amp;#5651;&amp;#5511;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1015336</field>
<field name="parent_node">
1015336</field>
</data>
</node>
