diff options
author | Simon Cozens <simon@netthink.co.uk> | 2000-12-11 01:21:45 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-11 15:02:21 +0000 |
commit | 1f5346dc23a1f0ea577a0a8dfa3e9472d228092d (patch) | |
tree | deeabe58826d73e4f76cab80c9c051a8dd95f1bc /pp.c | |
parent | 400728b860602b352de8071deef81019cfa0d73e (diff) | |
download | perl-1f5346dc23a1f0ea577a0a8dfa3e9472d228092d.tar.gz |
Re: [Fwd: BUG 20001205.022] Local on Hash elements
Message-ID: <20001211012144.A23467@deep-dark-truthful-mirror.perlhacker.org>
p4raw-id: //depot/perl@8077
Diffstat (limited to 'pp.c')
-rw-r--r-- | pp.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -2833,6 +2833,7 @@ PP(pp_hslice) while (++MARK <= SP) { SV *keysv = *MARK; SV **svp; + I32 preeminent = SvRMAGICAL(hv) ? 1 : hv_exists_ent(hv, keysv, 0); if (realhv) { HE *he = hv_fetch_ent(hv, keysv, lval, 0); svp = he ? &HeVAL(he) : 0; @@ -2845,8 +2846,15 @@ PP(pp_hslice) STRLEN n_a; DIE(aTHX_ PL_no_helem, SvPV(keysv, n_a)); } - if (PL_op->op_private & OPpLVAL_INTRO) - save_helem(hv, keysv, svp); + if (PL_op->op_private & OPpLVAL_INTRO) { + if (preeminent) + save_helem(hv, keysv, svp); + else { + STRLEN keylen; + char *key = SvPV(keysv, keylen); + save_delete(hv, key, keylen); + } + } } *MARK = svp ? *svp : &PL_sv_undef; } |