in reply to GetOpts::long Multiple Parameters per option
I think you're making this too complicated. Check the docs for Getopt::Long. The last part of the section Options with multiple values shows how to do what you want.
On the command line:use feature qw(say); use strict; use warnings; use Getopt::Long; my( @opt_a, @opt_b ); GetOptions( 'a=s{2}' => \@opt_a, 'b=s{2}' => \@opt_b, ); say "@opt_a"; say "@opt_b";
This example specifies exactly two arguments/parameters for each option, but note that you can specify a range for the number of options, if needed../pm-886569 -a a1 a2 -b b1 b2 a1 a2 b1 b2
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: GetOpts::long Multiple Parameters per option
by PyrexKidd (Monk) on Feb 07, 2011 at 01:26 UTC | |
by broomduster (Priest) on Feb 07, 2011 at 02:24 UTC | |
Re^2: GetOpts::long Multiple Parameters per option
by thargas (Deacon) on Feb 07, 2011 at 16:48 UTC |
In Section
Seekers of Perl Wisdom