http://qs321.pair.com?node_id=893487


in reply to Dynamic option

I was surprised a feature was recently added to Getopt::Long (2.35, to be specific) to addresses this very need!

$ perl -MData::Dumper -MGetopt::Long -e' my %options = ( input => [] ); GetOptions(\%options, "input=s{0,}", "des=s", "r=i") or die; print(Dumper(\%options)); ' -- -input data modem apps -des "finding files" -r 1000 $VAR1 = { 'r' => 1000, 'input' => [ 'data', 'modem', 'apps' ], 'des' => 'finding files' };

It's marked as experimental.