use Getopt::Long::Descriptive; my ($opt, $usage) = describe_options( 'usage: mxgotest.pl [-?] [long options...]', [ 'help|usage|?!' => 'Prints this usage information.' ], [ 'name=s' => 'Sets the name', { required => 1 } ], );