Perl source and tests have had all use of 'exists' on array elements / array refs removed. So running exists on an array element can lead to surprising behavior - because no one is testing what the behavior should be. So essentially the maintainers are reserving the right to modify this behavior by accident.

This situation seems to have come about because originally "exists" on array elements returned true if Perl had allocated a CV pointer for that index, where as now it returns True only if a CV pointer is both allocated and is not set to null. But this change over was not clean and and I think there are situations where it would not always be true. Imagine an array that is extremely large and fragmented in its use of indexes, where memory allocation has trimmed, extended, realloacted various CV linked lists etc. Does perl always only have a CV for each actually 'used' index position? The answer is apparently no.


In reply to Re: Using exists to check element in array by sectokia
in thread Using exists to check element in array by david

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.