diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-02 20:17:36 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-02 20:17:36 +0000 |
commit | c8faf1c59adb4175d5267a1413725f46ff602d48 (patch) | |
tree | 261390130f8f907e5fc0605684d080430baefc70 /pp.c | |
parent | 7a3f225871b642595bb66695465453bbff5332c7 (diff) | |
download | perl-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.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 */ |