|XP is just a number|
what is EOF and how can I send it?by revdiablo (Prior)
|on Jun 05, 2004 at 05:05 UTC||Need Help??|
revdiablo has asked for the
wisdom of the Perl Monks concerning the following question:
To start off, I am talking from a unix point of view. I know EOF is not a character, and it doesn't seem to be a unix signal. So, what is it?
The reason I ask, is because I have a program that wants to read two separate streams from STDIN. Example:
When run directly from the terminal, you can type a few lines of input, press ^D, type a few more, and press ^D again. Everything works as expected: the first while loop gets the first stream of input, the second gets the second.
Now, the question is, how to do what the terminal does when ^D is pressed? It's not sending the ^D char. It's catching the ^D keypress, and doing something. I looked in man bash for some guidance, and all it says is:
So, apparently bash "return[s] EOF," but what exactly is the EOF that it is returning, and how can I do that from a Perl program?
Any ideas will be appreciated.
Update: clarified a bit