in reply to How to give an EOF from windows Standard input?

I also use Vista and I don't see this:

c:\test>perl -nlE" say qq[>$_<]; " CON fred >fred< bill >bill< john >john< ^Z c:\test>perl -E" say qq[>$_<] while <STDIN>" fred >fred < bill >bill < john >john < ^Z

Perhaps you could post a small program and console log to demonstrate the problem?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Replies are listed 'Best First'.
Re^2: How to give an EOF from windows Standard input?
by thargas (Deacon) on Feb 11, 2011 at 19:33 UTC
    I've noticed that when I'm in a cmd window under windows the ^Z for eof is ignored until after I have hit enter. I.E. I have to use ^Z followed by enter. Perhaps that's what he meant?
Re^2: How to give an EOF from windows Standard input?
by marytjohn (Initiate) on Feb 11, 2011 at 16:47 UTC
    hey i got the issue i was giving Ctrl+Z then followed by some other commands. may be that caused the problem..now it works fine .. Also when i tried to run the perl script not from the command prompt directly from the perl for ex: the code #!/usr/local/bin/perl -w @lines= <STDIN>; print "@lines"; print"This is new \n"; i saved it as input.pl and when i clicked on that from the folder the prompt window was shown i was able to give the inputs and when i pressed Ctrl+Z the window was closed without showing the "This is new" text. How can i make my prompt window stay.

      Please use <code></code> tags around code in your posts.

      The console window will close as soon as the script ends. If you want the window to stay a round for a few seconds, add a sleep before it terminates:

      #!/usr/local/bin/perl -w @lines= <STDIN>; print "@lines"; print"This is new \n"; sleep 60;

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
      Depends whether you want the console window, which is what is generated for perl, or a cmd.exe shell. If it is a cmd.exe shell you want then run your perl script from a short-cut or association with:
      %comspec% /k perl c:\gash.pl
      where c:\gash.pl is the path to the script. It will run the script then give you a prompt.