summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-01-02 20:17:36 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-01-02 20:17:36 +0000
commitc8faf1c59adb4175d5267a1413725f46ff602d48 (patch)
tree261390130f8f907e5fc0605684d080430baefc70 /pp.c
parent7a3f225871b642595bb66695465453bbff5332c7 (diff)
downloadperl-c8faf1c59adb4175d5267a1413725f46ff602d48.tar.gz
fix 4-arg substr() when used as argument to subroutine
p4raw-id: //depot/perl@4747
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/pp.c b/pp.c
index 24ce99ca62..7fc6b1a73b 100644
--- a/pp.c
+++ b/pp.c
@@ -2021,7 +2021,9 @@ PP(pp_substr)
sv_pos_u2b(sv, &pos, &rem);
tmps += pos;
sv_setpvn(TARG, tmps, rem);
- if (lvalue) { /* it's an lvalue! */
+ if (repl)
+ sv_insert(sv, pos, rem, repl, repl_len);
+ else if (lvalue) { /* it's an lvalue! */
if (!SvGMAGICAL(sv)) {
if (SvROK(sv)) {
STRLEN n_a;
@@ -2050,8 +2052,6 @@ PP(pp_substr)
LvTARGOFF(TARG) = pos;
LvTARGLEN(TARG) = rem;
}
- else if (repl)
- sv_insert(sv, pos, rem, repl, repl_len);
}
SPAGAIN;
PUSHs(TARG); /* avoid SvSETMAGIC here */