Usage() && exit if grep{not exists $args->{$_}}@mandatory; #### #!/usr/bin/perl -w use strict; use Getopt::Declare; my $args = Getopt::Declare->new(<<'SPEC'); -x x coord (real) [required] -y y coord (real) [required] -z z coord (real) {print "Processing in three dimensions\n"} SPEC #rest of program... __END__