This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Must remember to proof-read my comments before committing...
[perl5.git] / pp_sys.c
index 7770dc2..6aa8645 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -2012,7 +2012,12 @@ PP(pp_eof)
                    IoLINES(io) = 0;
                    IoFLAGS(io) &= ~IOf_START;
                    do_open(gv, "-", 1, FALSE, O_RDONLY, 0, NULL);
-                   sv_setpvn(GvSV(gv), "-", 1);
+                   if ( GvSV(gv) ) {
+                       sv_setpvn(GvSV(gv), "-", 1);
+                   }
+                   else {
+                       GvSV(gv) = newSVpvn("-", 1);
+                   }
                    SvSETMAGIC(GvSV(gv));
                }
                else if (!nextargv(gv))