Inside a Perl script, I want to run a Java program that takes in 2 inputs, which will be passed by the command line.
So I do:
if (scalar @ARGV == 2)
{ print `java myProg $ARGV[0] $ARGV[1]`; }
elsif (scalar @ARGV == 1)
{ print `java myProg $ARGV[0]`; }
I works if I enter 2 args, but still hangs if I enter only 1 arg
How should I correct it?
BTW, the Java program works.
I changed my Perl script to:
print scalar @ARGV;
print `$ARGV[0]`;
print `$ARGV[1]`;
And if I run 'perl myPerl.pl abc def' in command line, it only prints 2. And not my two inputs. WHY!?