I'd like to be able to test and see if a user has entered any command line flags for a script. If they do not, I'd like to echo an error, however, if they do, I'd like the script to continue forward. I have:
#!/usr/bin/perl -w
use strict;
use Getopt::Long;
my $in;
GetOptions ( 'in=s' => \$in );
if ($#ARGV < 0) {
print "you need to put in some command line options!\n";
exit(1);
}
however, even when i run ./script --in something the warning is still echoed to the screen. Am i misinterpretting $#ARGV or does getopts::long decrease the value of $#ARGV as it reads in options?
humbly -c