http://www.perlmonks.org?node_id=574683

henrikbe has asked for the wisdom of the Perl Monks concerning the following question:

Hi folks!

This one should be simple: How can I output a EOF-character (Control-D) from my Perl program to a pipe?

The reason I ask is: I use a program (gprolog) that usually reads stuff (prolog definitions) from the keyboard, until the user presses Control-D, then it reads other stuff (prolog queries) from the keyboard. So, when my Perl script has fed gprolog with all the definitions and needs to do a query, it needs to send an EOF of some kind. Closing the filehandle is obviously not an option, since the script needs to do more IO after the EOF.

Thanks for any help,

Henrik