in reply to Re: Mapping array over a hash
in thread Mapping array over a hash

Autovivification does not occur here; it only happens when the non-existent thing in question is an lvalue:
%hash = qw( a 1 b 2 c 3 ); @array = (1,2,4,8); $x = $hash{z}; # no auto-viv $x = $array[10]; # no auto-viv 1 for $hash{y}; # auto-viv 1 for $array[7]; # auto-viv
Bonus: why are those bottom two treating the value in question as an lvalue?

_____________________________________________________
Jeff japhy Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Replies are listed 'Best First'.
Re: Re: Re: Mapping array over a hash
by larryk (Friar) on Jul 20, 2001 at 19:29 UTC
    looks like because they're being evaluated in list context - but I don't even know what vivification is, let alone autovivification

    I'm off to look it up.

    update: hell, I can't even spell it!

    update2: found a useful article here - turns out I do most of this already - I just didn't know what it was called!

    update3: for supersearch: "what is autovivification?" and for muppets like me in the supersearch "what is autovivication?"

    "Argument is futile - you will be ignorralated!"

      I was criticizing the use of the term "auto-vivify" -- merely creating entries in a hash by assigning values to them is not auto-vivifying. The process of these entries coming into being because their existence was implied is autovivification.

      _____________________________________________________
      Jeff japhy Pinyan: Perl, regex, and perl hacker.
      s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;