I am using Perl for the first time.
I am writing two scripts, and one of those is being called from the other.
While I am passing arguments from user input it's giving an error, but if I hard code the values it works fine.
Please advise how to solve.
Code:
script.pl
use warnings;
my ($choice);
print("Hello!\n");
print("If you want to Generate Add, enter 1.\n");
print("If you want to exit,enter 2.\n");
$choice = <>;
chomp($choice);
if ($choice eq "1") {
print "Please enter 1st argument:";
$inputFile = <STDIN>;
print "Please enter 2nd argument:";
$outputFile = <STDIN>;
system($^X, "generateLdifAdd.pl", $inputFile, $outputFile);
}
elsif ($choice eq "2") {
exit();
}
else {
print("$choice is an invalid response.\n");
}
use strictas well asuse warningsat the top of your programs.