in reply to Re^2: Perl autovivifyies object property when using exists
in thread Perl autovivifyies object property when using exists

It's worth noting that the default behavior of no autovivification doesn't disable it in case of assignments aka store

Which is great because that's DWIM for most. But surprising given the name of the pragma...

DB<5> no autovivification; $h->{a}{b}{c} = 42 DB<6> x $h 0 HASH(0xb400007e0b2fd8b8) 'a' => HASH(0xb400007e0b2ea7f8) 'b' => HASH(0xb400007e0b2eac30) 'c' => 42 DB<7>

From the autovivification docs

Possible unimports:

But store is not default

Cheers Rolf
(addicted to the Perl Programming Language :)
see Wikisyntax for the Monastery

Replies are listed 'Best First'.
Re^4: Perl autovivifyies object property when using exists
by Danny (Chaplain) on Apr 04, 2024 at 21:50 UTC
    Assignment "store" was the first thing I tested when I installed it yesterday :)