summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-02-03 19:41:11 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2004-02-03 19:41:11 +0000
commit59f00321bbc2d04656a65e0e9ccbbd93a8708e71 (patch)
treec0f54dac647290fc40828259685a2859be908403 /pp_ctl.c
parent81e59e001862de98bd8263eb307b4c909c0b16b8 (diff)
downloadperl-59f00321bbc2d04656a65e0e9ccbbd93a8708e71.tar.gz
Implement "my $_".
p4raw-id: //depot/perl@22263
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 9b2ca63b82..42d63c6d55 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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);
}