in reply to Re^3: New behavior of 'each' with respect to references
in thread New behavior of 'each' with respect to references

So the key "1" is present, but $a[1] doesn't exist...

Backwards. The element does exist even though exists says otherwise. (exists returns information about internal memory allocation.) This bug is why the use of exists is deprecated on array elements.

it's apparently not consistent with exists.

Being inconsistent with a buggy and deprecated feature is of no importance to me.

Replies are listed 'Best First'.
Re^5: New behavior of 'each' with respect to references
by educated_foo (Vicar) on May 17, 2011 at 19:53 UTC
    Being inconsistent with a buggy and deprecated feature is of no importance to me.
    I'm not sure how it's "buggy" -- it does exactly what it claims to do -- but it's clearly not "deprecated," since neither 5.8.9, 5.10.0, nor blead complains, even with -Mwarnings=deprecated. It's clearly a feature you don't like, but that's not the same as it being "deprecated."

      exists on array elements has been deprecated since 5.12.0.

      Be aware that calling exists on array values is deprecated and likely to be removed in a future version of Perl.

      Same for delete.

        Okay, so there are several meanings of "deprecated":
        1. "perl -w" will warn, but it probably won't be removed for awhile (e.g. split to @_).
        2. "perl -w" will warn, and it will be removed in the next major release.
        3. "perl -w" won't warn, but the docs call it "deprecated" or possibly "vaguely deprecated;" who knows what will happen?
        delete $a[$n] and exists $a[$n] are deprecated(3), whatever that means.