require Getopt::ArgParse; $ap = Getopt::ArgParse->new_parser { prog => "test_argparse.pl", description => "Test the Getopt::Argparse module" } $ap->add_argument('-c', '--count', type => Scalar); $ap->add_argument('-f', '--flag', type => Bool); $args = $ap->parse_args(); # Now, I am assuming that $args is a pointer to a hash array # that contains elements for "count" and "flag" if (! defined($args{'count'})) { print "count not defined\n"; } # The above code always prints the message even though I # executed the program with both options: # # > test_argparse.pl -c 10 # > test_argparse.pl --count 10