None of the getopt library like solutions, such as Getopt::Long, admit the syntax you want. If you can accept the syntax change to ./perl-script --xvariables 1,2,3,4 --yvariables 9,8,7 this won't be too difficult. Just make each multivalued option a string option and then split that string on comma to get arrays of values. This precludes data with commas, of course, but the idea can be modified to accomodate that. The following is adapted from Getopt::Long pod.
That lets you specify multiple values in one or more invocations of the option with comma delimited lists.use Getopt::Long; use vars qw/@xvals @yvals/; my $result = GetOptions ( 'xvariables=s' => \@xvals, 'yvariables=s' => \@yvals, ); @xvals = split /,/, join ',', @xvals; @yvals = split /,/, join ',', @yvals;
After Compline,
Zaxo
In reply to Re: Processing command line arguments
by Zaxo
in thread Processing command line arguments
by yoda54
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |