<?xml version="1.0" encoding="windows-1252"?>
<node id="1017165" title="Re: parsing help required" created="2013-02-05 08:51:43" updated="2013-02-05 08:51:43">
<type id="11">
note</type>
<author id="647953">
sundialsvc4</author>
<data>
<field name="doctext">
&lt;p&gt;
One very nice feature of Perl that can help here (which of course is &lt;em&gt;why&lt;/em&gt; it&amp;rsquo;s here ...) is called &lt;em&gt;autovivification:&lt;/em&gt; &amp;nbsp; &amp;ldquo;to come to life automatically.&amp;rdquo; &amp;nbsp; It lets you write code like this:
&lt;/p&gt;&lt;p&gt;
&lt;tt&gt;$$usercounts{$name} += $howmany;&lt;/tt&gt; ... &lt;br/&gt;&lt;i&gt;(or equivalently: &lt;tt&gt;$usercounts-&amp;gt;{$name} += $howmany;&lt;/tt&gt; ...)&lt;/i&gt;
&lt;/p&gt;&lt;p&gt;
... and simply not have to worry about whether the hashref &lt;tt&gt;$usercounts&lt;/tt&gt; already contains an entry for &lt;tt&gt;$name&lt;/tt&gt;. &amp;nbsp; If it does, cool. &amp;nbsp; But if it doesn&amp;rsquo;t, an entry is automagically created for you with an initial value of zero (because Perl knows that you&amp;rsquo;re going to add something to it). &amp;nbsp; Then, either way, the addition operation happens and life is good.
&lt;/p&gt;&lt;p&gt;
One of the things that I definitely like about this language is its &lt;em&gt;pragmatism.&lt;/em&gt; &amp;nbsp; It&amp;rsquo;s a tool for the job, designed and built by people who had a job to do. &amp;nbsp; Maybe in a few cases it tips a bit too far in the name of &amp;ldquo;DWIM  = Do What I Mean,&amp;rdquo; but generally it&amp;rsquo;s both powerful and expressive, both in a practical way.
&lt;/p&gt;

</field>
<field name="root_node">
1017139</field>
<field name="parent_node">
1017139</field>
</data>
</node>
