#!/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"; }