in reply to 5.24 -> 5.28 -- what has changed in autovivification?

I can't reproduce this, the output includes the "Can't vivify reference" error under both versions of Perl. Perhaps you're using different versions of the autovivification module?

And what would be the proper way to check existence of value in last line in ver 5.28?

The proper core-only way to check in any version of Perl is exists $$h{a} && exists $$h{a}{x} && exists $$h{a}{x}{z}. Using exists allows you to differentiate between a key not existing, a key existing and its value not being defined, and a key existing and having a false value. With no autovivification and if you know your values are always true, I guess you could say $$h{a} && $$h{a}{x} && $$h{a}{x}{z}, but I don't have much experience with that module.

Note that there are other modules you can use to look at data structures without autovivifying them, without changing the behavior of core Perl, such as Data::Diver.

Replies are listed 'Best First'.
Re^2: 5.24 -> 5.28 -- what has changed in autovivification?
by leszekdubiel (Scribe) on Apr 17, 2020 at 15:58 UTC

    Thank you for hints. I will check diver module.

    PS. In case anybody has the same problem versions were from Debian Stretch and Buster installations:

    # command: # perl -e 'print $], "\n"; ' ; dpkg -l | egrep autovivifi # Debian buster: 5.028001 ii libautovivification-perl 0.18-1+b1 amd +64 pragma for lexically disabling autovivification # Debian stretch: 5.024001 ii libautovivification-perl 0.16-1+b2 + amd64 pragma for lexically disabling autovivification
        #!/usr/bin/env perl use warnings; use strict; no autovivification qw{fetch store exists delete}; my $h = { a => { p => 2, q => 3 } }; print "perl ver $], autoviv ver $autovivification::VERSION:\n"; ! $$h{a}{x}{z} and print "a/x/z not\n"; __END__ perl ver 5.024004, autoviv ver 0.16: a/x/z not perl ver 5.028001, autoviv ver 0.16: a/x/z not perl ver 5.024004, autoviv ver 0.18: Can't vivify reference at a.pl line 9. perl ver 5.028001, autoviv ver 0.18: Can't vivify reference at a.pl line 9.