in reply to GetOpts::long Multiple Parameters per option
The command line in that case would look like either of these (both will work)my @a; my @b; GetOptions ( "a=s" => \@a, "b=s" => \@b ); @a = split(/,/,join(',',@a)); @b = split(/,/,join(',',@b)); if ( scalar(@a) !=2 || scalar(@b) !=2 ){ # shout at user here }
orperl the_script -a 1 -a 2 -b 10 -b 30
I think the requirement to either specify the option name along with a value or use comma-separation makes the command a little clearer to read. Personal preference really.perl the_script -a 1,2 -b 10,30
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: GetOpts::long Multiple Parameters per option
by thargas (Deacon) on Feb 08, 2011 at 12:46 UTC |