summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/toke.c b/toke.c
index 4eef362ae5..ebb3550757 100644
--- a/toke.c
+++ b/toke.c
@@ -10720,7 +10720,9 @@ S_scan_subst(pTHX_ char *start)
sv_catpv(repl, es ? "eval " : "do ");
sv_catpvs(repl, "{");
sv_catsv(repl, PL_lex_repl);
- sv_catpvs(repl, "\n}");
+ if (strchr(SvPVX(PL_lex_repl), '#'))
+ sv_catpvs(repl, "\n");
+ sv_catpvs(repl, "}");
SvEVALED_on(repl);
SvREFCNT_dec(PL_lex_repl);
PL_lex_repl = repl;