I hope this is not a silly question. Can someone please define autovivify for me?
I have seen it around the monastery but have never found a clear explanation...
Thanks
--
bm
Vivify:to give life to; bring to life; to animate.
my $hash;
print "\$hash is: ", defined $hash ? $hash : "undefined", "\n";
if ($hash->{one}){
print "'one' exists\n";
}
print "\$hash is: ", defined $hash ? $hash : "undefined", "\n";
$hash is undefined, but when we use it as if it were
a reference to a hash ($hash->{one}) perl automatically
brings a hash reference to life and stores it in $hash.
Hence, it autovivifies the hash reference for us.