4 ms·
Perl 5 has a problem with multilevel existence checks. Unfortunately this has been part of Perl 5 for such a long time that too many programs depend on this be
by lizmat 8y ago
Perl 5 has a problem with multilevel existence checks. Unfortunately this has been part of Perl 5 for such a long time that too many programs depend on this behaviour. Attempts at fixing this behaviour have all been reverted as far as I know.
Perl 6 does not have that problem. One can even bind an alias to non-existing keys in a hash (several levels deep) only to have vivification happen as soon as you assign to the alias.
my %h;
my $deep := %h<a><b><c>;
say %h<a>:exists; # False
say %h<a><b>:exists; # False
say %h<a><b><c>:exists; # False
$deep = 42;
say %h<a><b><c>:exists; # True