sub usage { pod2usage(-exitval => 1, -verbose => 0); } sub help { pod2usage(-exitval => 0, -verbose => 0); } sub man { pod2usage(-exitval => 0, -verbose => 2); } if (!GetOptions( 'config|c=s' => \$config, 'stop' => \$stop, 'start' => \$start, 'help|?' => \&help, # Show help and exit. 'man' => \&man, # Show man and exit. )) { # A bad argument was encountered. # Show help and exit with error. usage(); } if (!$stop && !$start) { # At least one of the commands needs to be specified. # Show help and exit with error. usage(); }