Getopt::Long::Descriptive is a Getopt::Long module with usage text.
my ($opts, $usage) = describe_options($format, @opts, %arg);
$format = "usage: myprog %o myarg...";
%o will be replaced with a list of the short options, as well as the text "[long options...]" if any have been defined.
%c will be replaced with what Getopt::Long::Descriptive thinks is the program name (see "prog_name"). You can override this guess by calling prog_name($string) yourself.
Because of this, any literal % symbols will need to be written as %%.
Option specifications are the same as in Getopt::Long. You should pass in an array of arrayrefs whose first elements are option specs and whose second elements are descriptions.
my @opts = (
[ "verbose|V" => "be noisy" ],
[ "logfile=s" => "file to log to" ],
Option specifications may have a third hashref argument. If present, this configures extra restrictions on the value or presence of that option.
You may cause a blank line to be printed by passing an empty arrayref. Likewise, a plain descriptive line will be printed if you pass an arrayref with a single element:
@opts = (
[ 'other options:' ],