diff options
author | Simon Cozens <simon@netthink.co.uk> | 2000-12-28 20:33:13 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-28 21:52:42 +0000 |
commit | d804643f1d3e26c9c696bb1ebe8344dd5f1c8f6d (patch) | |
tree | 62c294e518d95ff78b72649c44e4f49b5eec3a30 /pp_hot.c | |
parent | 0d73d187eb6a7f76dde07ae608622944dbccd4e9 (diff) | |
download | perl-d804643f1d3e26c9c696bb1ebe8344dd5f1c8f6d.tar.gz |
Re: [PATCH] Warn on use of reference as array elem
Message-ID: <20001228203313.A2607@deep-dark-truthful-mirror.perlhacker.org>
p4raw-id: //depot/perl@8234
Diffstat (limited to 'pp_hot.c')
-rw-r--r-- | pp_hot.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2815,12 +2815,15 @@ PP(pp_aelem) { djSP; SV** svp; - IV elem = POPi; + SV* elemsv = POPs; + IV elem = SvIV(elemsv); AV* av = (AV*)POPs; U32 lval = PL_op->op_flags & OPf_MOD; U32 defer = (PL_op->op_private & OPpLVAL_DEFER) && (elem > AvFILL(av)); SV *sv; + if (SvROK(elemsv) && ckWARN(WARN_MISC)) + Perl_warner(aTHX_ WARN_MISC, "Use of reference \"%s\" as array index", SvPV_nolen(elemsv)); if (elem > 0) elem -= PL_curcop->cop_arybase; if (SvTYPE(av) != SVt_PVAV) |