Reapeating options

Dec 23, 2013 at 4:43 PM
Hi,

I'd like to ask if repeating options are alowed and in that case how to use them. Following is an extract from Perl GetOpt documentation explaining this feature.
TEXT
Hairy Stuff
If an argument specifier is suffixed with an @, then the option may be given multiple times on the command line, and the corresponding value in %Options becomes a reference to an array containing all the values supplied for that option. For example:
GetOptions(\%Options, "x=f@", "y=f@")
will parse
graph --x 1 --x 2 --x 3 --y 1 --y 4 --y 9
resulting in
%Options = (x => [1, 2, 3], y => [1, 4, 9])
Similarly, if an argument specifier is suffixed with a %, then the option takes key=value pairs, and the corresponding value in %Options becomes a reference to a hash of those pairs. So
GetOptions(\%Options, "define=s%")
will parse Stroustrup's example
cc --define sqrt=rand --define exit=abort hello.cc
resulting in
%Options = (define => { sqrt => 'rand', exit => 'abort' })