in reply to Enforce single hyphen for single character options in Getopt::Long
posix_default sets POSIXLY_CORRECT and then from Configuring Getopt::Long ...use Getopt::Long qw( :config posix_default gnu_compat bundling no_auto_abbrev no_ignore_case ); my $column = 1; GetOptions( 'column|c=i' => \$column, ) or die; ...I want this program to accept exactly two strings as options, --column and -c, but it also accepts --c. I want the prefix for short options to be - and only -, similar to how -- is treated for long options when bundling is enabled
- prefix_pattern
- A Perl pattern that identifies the strings that introduce options. Default is --|-|\+ unless environment variable POSIXLY_CORRECT has been set, in which case it is --|-.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Enforce single hyphen for single character options in Getopt::Long
by parv (Parson) on Feb 25, 2024 at 10:10 UTC | |
by parv (Parson) on Feb 25, 2024 at 11:52 UTC |