I suppose it didn't execute the external program, right? I used your code, like: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
#! 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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |