on-internet
← Community

How to group the arguments while using Getopt::Long?

Stack Overflow ·

To a Perl script that I am writing, there can be a lot (~50) of command line options provided. Most of them are optional, so a call will have only some of the options provided. I am using Getopt::Long but it does not allow me to use GetOptions more than once. As a result, I have to use all the command line options in one GetOptions call. Is there some good way to group the options while using GetOptions? $ cat test.pl use strict; use warnings; use Getopt::Long; my ($a, $b, $c, $d); GetOptions ('a=s' => \$a, 'b=s' => \$b); GetOptions ('c=s' => \$c, 'd=s' => \$d); print "a = $a\nb = $b\nc = $c\n

Comments

Sign in or sign up to comment and upvote.

No comments yet.