diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-03 19:41:11 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-02-03 19:41:11 +0000 |
commit | 59f00321bbc2d04656a65e0e9ccbbd93a8708e71 (patch) | |
tree | c0f54dac647290fc40828259685a2859be908403 /pp_ctl.c | |
parent | 81e59e001862de98bd8263eb307b4c909c0b16b8 (diff) | |
download | perl-59f00321bbc2d04656a65e0e9ccbbd93a8708e71.tar.gz |
Implement "my $_".
p4raw-id: //depot/perl@22263
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -863,14 +863,19 @@ PP(pp_grepstart) ENTER; /* enter outer scope */ SAVETMPS; - /* SAVE_DEFSV does *not* suffice here for USE_5005THREADS */ - SAVESPTR(DEFSV); + if (PL_op->op_private & OPpGREP_LEX) + SAVESPTR(PAD_SVl(PL_op->op_targ)); + else + SAVE_DEFSV; ENTER; /* enter inner scope */ SAVEVPTR(PL_curpm); src = PL_stack_base[*PL_markstack_ptr]; SvTEMP_off(src); - DEFSV = src; + if (PL_op->op_private & OPpGREP_LEX) + PAD_SVl(PL_op->op_targ) = src; + else + DEFSV = src; PUTBACK; if (PL_op->op_type == OP_MAPSTART) @@ -965,7 +970,10 @@ PP(pp_mapwhile) /* set $_ to the new source item */ src = PL_stack_base[PL_markstack_ptr[-1]]; SvTEMP_off(src); - DEFSV = src; + if (PL_op->op_private & OPpGREP_LEX) + PAD_SVl(PL_op->op_targ) = src; + else + DEFSV = src; RETURNOP(cLOGOP->op_other); } |