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 | |
by swl (Prior) on Apr 18, 2020 at 00:36 UTC | |
by haukex (Archbishop) on Apr 18, 2020 at 07:17 UTC | |
by leszekdubiel (Scribe) on Apr 18, 2020 at 20:45 UTC | |
by haukex (Archbishop) on Apr 18, 2020 at 22:08 UTC | |
| |
by choroba (Cardinal) on Apr 18, 2020 at 21:44 UTC |