in reply to Re^2: When DOESN'T "Use of uninitialized value" show up?
in thread When DOESN'T "Use of uninitialized value" show up?

Actually that was exactly the case I had in mind when I made the statement. "b => {}" is required so that the presence of {c} can be checked. In fact I updated the OP's sample to include exists $x->{notdef}{notdeftoo} to demonstrate this case.

True laziness is hard work

Replies are listed 'Best First'.
Re^4: When DOESN'T "Use of uninitialized value" show up?
by moritz (Cardinal) on Dec 17, 2011 at 08:36 UTC
    "b => {}" is required so that the presence of {c} can be checked.

    And that's the part where I disagree. If $a->{b} doesn't exist, we know that $a->{b}{c} cannot exist, and perl could know too. The fact that such reads autovivify are really only due to a quirk in the implementation, and not deducible from a general rule like "autovivification happens only when it needs to".

      And that's the part where I disagree. If $a->{b} doesn't exist, we know that $a->{b}{c} cannot exist,

      But he isn't checking if $a->{b} exists, so it's possible that $a->{b}{c} can exist. Perl is being asked if $a->{b}{c} exists, and it's being done a few steps after autovivifying $a->{b}.