in reply to Generating EOF character on Win98

I have a Win98 system running Perl v5.6 that I booted up especially for you. :) Your code works fine, if, as I suggested in the Chatterbox, you add a newline to your last print statement (i.e. print "hello\n"). STDOUT isn't getting flushed on exit.

Replies are listed 'Best First'.
Re: Re: Generating EOF character on Win98
by nysus (Parson) on Jul 23, 2001 at 21:52 UTC
    Well, I did give your recommendation a shot but it just didn't work. This is weird.

    $PM = "Perl Monk's";
    $MCF = "Most Clueless Friar Abbot Bishop";
    $nysus = $PM . $MCF;
    Click here if you love Perl Monks

(tye)Re: Generating EOF character on Win98
by tye (Sage) on Jul 23, 2001 at 22:03 UTC

    It works for me even without the final newline.

    Another interesting point is that nysus mentioned that pressing CTRL-Z causes the program to terminate immediately where my experience (and current testing) shows that you have to press ENTER after the CTRL-Z for the EOF to be noticed by the program.

    I'm not sure where to look next but I'd probably look at the "DOS properties" of the window that the script is running in. Perhaps the CTRL-Z key sequence has been found to some other function? (Though I can't see how even that would explain the stated behavior.)

            - tye (but my friends call me "Tye")
      Oh brother. Now I know why I feel a need to keep a crucifix handy when I work on a PC. On my setup it works the first time I run it (defined as printing 'hello' after ^Z is pressed). Forever after that (well, several times, until I get bored) the 'hello' is not displayed. I have to reboot the PC in order to see 'hello' again. Très weird.

      I have only investigated far enough to note that, as you say, the newline doesn't appear to figure in this at all. It works the first time, and then not again until I restart. Killing the MS-DOS window and starting another one doesn't help.

Re: Re: Generating EOF character on Win98
by John M. Dlugosz (Monsignor) on Jul 24, 2001 at 01:21 UTC
    You don't need a final newline under Win32, either to make it flush or to prevent the prompt from overwriting your line.