running jar file with multiple arguments in perl
"java -ja开发者_C百科r program.jar < abc.txt"
where abc.txt has a value of :
2
1
3
etc.
but its not working its only getting the first value.
please help. thanks.
btw, ive also try :
OPEN PIPE, "| java -jar program.jar";
open (FH, /abc.txt)
print PIPE "$res";
close FH;
close PIPE;
Regards
Note sure why your current approach is not working. You may want to take a look at the Expect module on CPAN.
I reckon the entire contents of the file is being piped all at once to the first prompt, so the remainder of the file just gets 'swallowed' and lost
So, +1 to jackrabbit's suggestion of using the Expect module instead
精彩评论