I know I can validate that the input argument was there via the following bit of code:
chomp(my $in1 = $ARGV[0] || '');
if (defined $in1) {
#Validate;
}
Have you ever encountered a case where $in1 was not defined?
Maybe you want to directly check the number of arguments in @ARGV or look at what the || operator does?
Maybe the following code helps you analyze what happens better:
my $in1 = $ARGV[0] || 'user-did-not-pass-an-argument');
print $in1;
Run the above code with
perl -w myscript.pl # no argument
perl -w myscript.pl "" # empty argument
perl -w myscript.pl 0 # zero argument
perl -w myscript.pl something-else # other argument