note
Joost
autovivication basically means that datastructures are automatically expanded at first use.
<p>
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:
<c>
#!/usr/bin/perl -w
use strict;
my %hash = ();
$hash{a}->{b} = 1;
print $hash{a}->{b};
</c>
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.
<p>
Note that perl will still throw an error when you for example treat a hash reference as an array reference, so there's still <em>some</em> checking going on.
<P>
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-157432">
<em>[id://149675|"What should it profit a man, if he should win a flame war, yet lose his cool?"]</em>
</div></div>
691557
691557