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

Okay, I am fairly new to programming, so I apologize if I am asking a stupid question.

I have been given a program written in C that I have a large number of files to enter as input. I am trying to write a Perl script to automate everything, but am having issues.

In Perl, I use the backticks to call the program as well as the input and output. I.e. my$results = `my_fave_program $input $output_path`; The problem is, when I run the C program from the command line, it asks a series of questions that require the Return key to be hit before moving on to the next question. HELP. I do not know how to write this into my code!

Replies are listed 'Best First'.
Re: running a shell script and entering commands in perl
by Fletch (Bishop) on Sep 15, 2008 at 18:32 UTC

    Sounds like you're looking for either Expect (or possibly IPC::Run).

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

      Fletch Thanks a lot. I had been looking at Expect, but am not understanding it. Perhaps I need to look at it a lot more. I will also look at the IPC::Run Thanks again.