[win32] fix C<print "foo ${\()}"> (pp_refgen fumbles when G_SCALAR, no args)
Gurusamy Sarathy [Thu, 7 May 1998 03:40:15 +0000 (03:40 +0000)]
p4raw-id: //depot/win32/perl@916

pp.c

diff --git a/pp.c b/pp.c
index 3dc5a72..7d9b529 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -442,8 +442,13 @@ PP(pp_refgen)
 {
     djSP; dMARK;
     if (GIMME != G_ARRAY) {
-       MARK[1] = *SP;
-       SP = MARK + 1;
+       if (++MARK <= SP)
+           *MARK = *SP;
+       else
+           *MARK = &sv_undef;
+       *MARK = refto(*MARK);
+       SP = MARK;
+       RETURN;
     }
     EXTEND_MORTAL(SP - MARK);
     while (++MARK <= SP)