Hello fellow monks!
I need to call a rather old program through a perl script that I have written.
The problem is that this program is interactive and "asks" the user some questions.
Is there a way that perl can help me answer this questions by passing the answers as arguments when I call the program in the command line?
The questions are:
1. enter file name (you must specify the file name and press Enter)
2. do you want to specify another file name (Y/N) (you must enter N in
+ most cases and press Enter)
3.enter name for output file (you must specify a name for the output f
+ile, eg ttt and press Enter)
I really don't have a clue as what to do, I tried (unsuccessfully) to write something like:
run_prog (name of the program) myfile.txt N myfile.txt.out
Apparently it can't take these arguments as I tried.
Any thoughts?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.