The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


Getopt::Long::Less - Like Getopt::Long, but with less features


This document describes version 0.091 of Getopt::Long::Less (from Perl distribution Getopt-Long-Less), released on 2023-05-04.


This module is a reimplementation of Getopt::Long, with less features/configurability. Only the subset which I'm currently using (which I think already serves a lot of common use cases for a lot of people too) is implemented.

Only three functions are implemented: GetOptions, GetOptionsFromArray, and Configure.

No configuring from use statement. No OO interface.

Much much less modes/configuration. No support for POSIXLY_CORRECT. We always do bundling (this is not Getopt::Long's default), we never ignore case (this is not Getopt::Long's default), we always permute, we always autoabbreviate, we always do GNU compatibility (allow --opt=VAL in addition to --opt VAL including allowing --opt=), we never do getopt_compat. Basically currently there's no mode you can configure (although pass_through might be added in the future).

No autoversion, no autohelp. No support to configure prefix pattern.

No support for GetOptions' "hash storage mode" (where the first argument is a hashref) nor "classic mode" (where destination is not explicitly specified). Basically, the arguments need to be pairs of option specifications and destinations.

Currently no support for arrayref destination (e.g. "foo=s" => \@ary). No support for array desttype ('foo=s@' => ...).

Also, this module requires 5.010.

So what's good about this module? Slightly less compile time overhead, due to less code. This should not matter for most people. I just like squeezing out milliseconds from startup overhead of my CLI scripts. That's it :-)


Please visit the project's homepage at


Source repository is at



If you want more features intead of less, try Getopt::Long::More.

Benchmarks in Bencher::Scenario::GetoptModules


perlancar <>


To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

 % prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.


This software is copyright (c) 2023, 2019, 2016, 2015 by perlancar <>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


Please report any bugs or feature requests on the bugtracker website

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.