murphya has asked for the wisdom of the Perl Monks concerning the following question:
Everything works fine when I answers the questions manually. However, I would like to be able to pipe in an a text file containing the answers, to automate the process (Eg program.x < answers). This works well with a csh script, but not with the Perl one. The fortran program prints an end of file error, so it knows to read from STDIN, but there is nothing being passed. I think that the problem comes from the split read of STDIN, and all I need to do is pump the rest of the data in STDIN down to the executable.
Currently I am opening a temp file, reading the STDIN stream to it and then piping it into the executable in the system command. I don't really like this.
open(IN,">tmp.input"); print IN <STDIN>; close(IN); $error = system("$runbin/$program.x < tmp.input");
Can anyone think of a cleverer way to use a pipe (or anything else) to redirect the rest of STDIN into the executable?
Stupid.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Split STDIN Pipe
by stephen (Priest) on Apr 13, 2001 at 01:35 UTC | |
by Anonymous Monk on Apr 14, 2001 at 07:14 UTC |