This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
update epigraph
[perl5.git] / pp.c
diff --git a/pp.c b/pp.c
index 999275f..df80830 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -1998,9 +1998,9 @@ static IV S_iv_shift(IV iv, int shift, bool left)
 
     /* For left shifts, perl 5 has chosen to treat the value as unsigned for
      * the * purposes of shifting, then cast back to signed.  This is very
-     * different from perl 6:
+     * different from Raku:
      *
-     * $ perl6 -e 'say -2 +< 5'
+     * $ raku -e 'say -2 +< 5'
      * -64
      *
      * $ ./perl -le 'print -2 << 5'
@@ -3520,11 +3520,16 @@ PP(pp_index)
   push_result:
     /* OPpTRUEBOOL indicates an '== -1' has been optimised away */
     if (PL_op->op_private & OPpTRUEBOOL) {
-        PUSHs( ((retval != -1) ^ cBOOL(PL_op->op_private & OPpINDEX_BOOLNEG))
-                    ? &PL_sv_yes : &PL_sv_no);
-        if (PL_op->op_private & OPpTARGET_MY)
+        SV *result = ((retval != -1) ^ cBOOL(PL_op->op_private & OPpINDEX_BOOLNEG))
+            ? &PL_sv_yes : &PL_sv_no;
+        if (PL_op->op_private & OPpTARGET_MY) {
             /* $lex = (index() == -1) */
-            sv_setsv(TARG, TOPs);
+            sv_setsv_mg(TARG, result);
+            PUSHs(TARG);
+        }
+        else {
+            PUSHs(result);
+        }
     }
     else
         PUSHi(retval);
@@ -5898,6 +5903,7 @@ PP(pp_reverse)
            sv_setsv(TARG, DEFSV);
            XPUSHs(TARG);
        }
+        SvSETMAGIC(TARG); /* remove any utf8 length magic */
 
        up = SvPV_force(TARG, len);
        if (len > 1) {