Thanks a lot for your time!
I have 2 questions:
a) The code you kindly provided should be in 2 separate programs? I put it in one perl script, correct?
b) The old program I need to run has its executable in /usr/local/bin. Will the script need me to specify its full path?
I tried what you wrote and returned
enter file name (you must specify the file name and press Enter) Test.file do you want to specify another file name (Y/N) (you must enter N in mo +st cases and press Enter) N enter name for output file (you must specify a name for the output fil +e, eg ttt and press Enter) Result.file reading Test.file; writing Result.file
I suppose it didn't execute the external program, right? I used your code, like:
#! perl -slw use strict; print "enter file name (you must specify the file name and press Ente +r)"; chomp( my $infile = <STDIN> ); print "do you want to specify another file name (Y/N) (you must enter +N in most cases and press Enter)"; chomp( my $another = <STDIN> ); print "enter name for output file (you must specify a name for the out +put file, eg ttt and press Enter)"; chomp( my $outfile = <STDIN> ); print "reading $infile; writing $outfile"; exit 99; my $progname = '/usr/local/bin/simpa96'; #--->this is the name of the + external program I need to pass the parameters to my $pid = open CMD, '|-', $progname or die $!; print CMD 'myInfile'; print CMD 'N'; print CMD 'myOutfile'; close CMD; waitpid $pid, 0; print "$progname ended: status: ", $? >>8;

In reply to Re^2: "Answer" questions in an interactive program? by Anonymous Monk
in thread "Answer" questions in an interactive program? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.