This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
$overloaded .= $x: don't stringify $x
[perl5.git] / pp_hot.c
index d1d0225..7609638 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -661,6 +661,19 @@ PP(pp_multiconcat)
                  */
                 assert(!targ_chain);
                 dsv = newSVpvn_flags("", 0, SVs_TEMP);
+
+                if (   svpv_end == svpv_buf + 1
+                       /* no const string segments */
+                    && aux[PERL_MULTICONCAT_IX_LENGTHS].ssize == -1
+                ) {
+                    /* special case $overloaded .= $arg1:
+                     * avoid stringifying $arg1.
+                     * Similar to the $arg1 . $arg2 case in phase1
+                     */
+                    svpv_end--;
+                    SP--;
+                }
+
                 goto phase3;
             }
         }