On Sun, Jun 05, 2005 at 10:13:47AM +0200, Rafael Garcia-Suarez wrote:
> On 6/5/05, Dave Mitchell <[EMAIL PROTECTED]> wrote:
> > Can't really be fixed short of using some other static SV to mark unused
> > elements (cf PL_sv_placeholder), but personally I think that's throwing
> > good money after bad.
> 
> I agree with this. exists() on arrays seems to be a bit useless to me,
> or not well-defined, and I'm not in favor of sacrifying array
> performance to make it work. Moreover testing (@_ >= 1) can already be
> used to count number of arguments (to refer to the OP's problem.)

How do you feel about this:

--- perl/av.c.orig      2005-06-02 01:07:41.000000000 -0700
+++ perl/av.c   2005-06-06 02:05:04.853572800 -0700
@@ -927,8 +927,8 @@ Perl_av_exists(pTHX_ AV *av, I32 key)
            return FALSE;
     }
 
-    if (key <= AvFILLp(av) && AvARRAY(av)[key] != &PL_sv_undef
-       && AvARRAY(av)[key])
+    if (key <= AvFILLp(av) && AvARRAY(av)[key]
+        && (AvARRAY(av)[key] != &PL_sv_undef || ! AvREAL(av)))
     {
        return TRUE;
     }

which should make exists true for any parameter actually passed, so
long as @_ isn't reified.

Reply via email to