> > > The value.  If you wanted to increment the key, you would say
> > > "$hash{$key++}".
> >
> > Wait a sec, brain cramp....
> > Wouldn't that:
> >   1) just access $hash{$key}
> >   2) increment $key
> >   3) add $hash{$key + 1}
> >
>
> I realize this is getting away from the original post, but I'm
confused by
> #3 here.  Wouldn't it just do 1 and 2?  Would it actually access the
hash
> twice?

It all depends.

In simple cases, step 3 will happen momentarily,
but if you haven't used it, then it will go away, and
the new key won't be defined.

But if it's part of a larger expression that also
dereferences out of the new element, then the
new element will remain defined, even if that's
not what you wanted.

The topic is called 'autovivification'.
See p 254 of Camel 3rd edition for more.

Reply via email to