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

I have an executable which needs a "return key press" once its complete?Is there a way to get pass the return press at the end of a perl executable? It is causing problems for me as I am trying to incorporate a executable in another script

Replies are listed 'Best First'.
Re: Perl inquiry
by ambrus (Abbot) on Jul 01, 2011 at 20:31 UTC

    Try running yes | someprogram. That's what yes is for, isn't it?

    If you're so unlucky to be stuck on a Windows machine with no access to unix tools, you can try echo | someprogram instead. That has the disadvantage of outputting only a single line, so if your program is waiting for more, it may still get stuck: in that case redirect an input file with several newlines to it, such as <\path\to\yes.txt someprogram where you previously create the file yes.txt which contains lots of empty lines.

Re: Perl inquiry
by davido (Cardinal) on Jul 01, 2011 at 18:29 UTC

    Remove the line from your code that is asking for the keypress. If you didn't write the code, and you don't know how to modify it, ask the author. Or as an alternative, post no more than ten lines of code showing how a keypress is being required so that we can advise accurately how to remove that constraint.


    Dave