"be consistent" | |
PerlMonks |
Re: Arrow Operator Questionby tobyink (Canon) |
on Mar 26, 2023 at 11:54 UTC ( [id://11151231]=note: print w/replies, xml ) | Need Help?? |
As others have said, it's autovivification. As a quick way to explain why the 'c' key gets created, but not 'd' though: $a->{b}{c}{d} is looking for a 'd' key within $a->{b}{c}, so you are asserting that $a->{b}{c} must be a hashref for your program to succeed at all. So Perl makes it a hashref for you. But you're not asserting anything in particular about the nature of $a->{b}{c}{d}, so Perl doesn't make it anything.
In Section
Seekers of Perl Wisdom
|
|