in reply to Re: Why nothing from 'strict' or 'warnings' with deref'd undef value?
in thread Why nothing from 'strict' or 'warnings' with deref'd undef value?

Thanks for the <c> tip! I'll be sure to do that from now on.

This all makes sense and my exact example is even right there in the PerlDoc! Time to read up again or get better at Googling...

What is a valid use for autovivification outside of an assignment operation? I can certainly see the value of
$ref->[0]{field} = "value";
but I don't see how my first example can be very useful without an assignment.
  • Comment on Re^2: Why nothing from 'strict' or 'warnings' with deref'd undef value?
  • Download Code

Replies are listed 'Best First'.
Re^3: Why nothing from 'strict' or 'warnings' with deref'd undef value?
by ikegami (Patriarch) on Apr 03, 2009 at 02:03 UTC

    That very question just came up on p5p, the Perl developers' mailing list. It turns out that some rvalue operations autovivify and some don't. Spoke Nicolas Clark, the pumpking:

    So why are indexing and defined special?
    Are they the only exceptions to the exception?

    No answer was obtained.

    Source: Perl RT 63810

      Perfect - exactly what I was looking for. Additional examples are even more interesting.

      Thank you for everything.