Disclaimer: I never tried this feature that is declared "experimental", so I really don't know if it works at all.
From Getopt::Long POD:
Warning: What follows is an experimental feature.
Options can take multiple values at once, for example
--coordinates 52.2 16.4 --rgbcolor 255 255 149
This can be accomplished by adding a repeat specifier to the option specification. Repeat specifiers are very similar to the {...} repeat specifiers that can be used with regular expression patterns. For example, the above command line would be handled as follows:
GetOptions('coordinates=f{2}' => \@coor, 'rgbcolor=i{3}' => \@color);
The destination for the option must be an array or array reference.
It is also possible to specify the minimal and maximal number of arguments an option takes. foo=s{2,4} indicates an option that takes at least two and at most 4 arguments. foo=s{,} indicates one or more values; foo:s{,} indicates zero or more option values.
So, if I understand correctly, an option like:
'files|f:s{,}' => \@input_array->{files}could work as you expected.
Rule One: "Do not act incautiously when confronting a little bald wrinkly smiling man."
In reply to Re: get array from getoptions
by psini
in thread get array from getoptions
by Utrecht
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |