$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'); #### $ap->add_argument('--count', '-c', type => 'Scalar'); $ap->add_argument('--flag', '-f', type => 'Bool'); #### if (! defined($args->{'count'})) { #### if (! defined($args->get_attr('count'))) { #### if (! defined($args->count)) { #### #!/usr/bin/perl -w use strict; require Getopt::ArgParse; my $ap = Getopt::ArgParse->new_parser( { prog => "test_argparse.pl", description => "Test the Getopt::Argparse module" }); $ap->add_argument('--count', '-c', type => 'Scalar'); $ap->add_argument('--flag', '-f', type => 'Bool'); my $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"; }