<?xml version="1.0" encoding="windows-1252"?>
<node id="691571" title="Re: Explaining Autovivication" created="2008-06-11 20:49:38" updated="2008-06-11 16:49:38">
<type id="11">
note</type>
<author id="157432">
Joost</author>
<data>
<field name="doctext">
autovivication basically means that datastructures are automatically expanded at first use.
&lt;p&gt;
For instance, if you've got a hash and access a not previously instantiated element and treat it like a hash reference, a hash reference will be created for you:
&lt;c&gt;
#!/usr/bin/perl -w
use strict;

my %hash = ();
$hash{a}-&gt;{b} = 1;
print $hash{a}-&gt;{b};
&lt;/c&gt;
This means you need to do less explicit typing/instantiating, at the cost of possibly accidentally creating structures that aren't there when you mistype.
&lt;p&gt;
Note that perl will still throw an error when you for example treat a hash reference as an array reference, so there's still &lt;em&gt;some&lt;/em&gt; checking going on.
&lt;P&gt;
&lt;!-- Node text goes above. Div tags should contain sig only --&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-157432"&gt;
&lt;em&gt;[id://149675|"What should it profit a man, if he should win a flame war, yet lose his cool?"]&lt;/em&gt;

&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
691557</field>
<field name="parent_node">
691557</field>
</data>
</node>
