Reputation: 5247
Have the below getoptions function. iifiles argument is optional and it can be 1 to many if provided. But when i run this function getting an error message "Error in option spec". Perl running on solaris 10. Not sure what multiple values option for iiles needs to be provided.
GetOptions( 'reportdate=s' => \$cmdParams{repDate}
,'switch=s' =>\$cmdParams{swi}
,'iiles:s{,}' => \@inputFileArray
,'h|?|help' => \$help
);
Upvotes: 2
Views: 1593
Reputation: 107040
Perl running on solaris 10. Not sure what multiple values option for iiles needs to be provided.
There's your problem. What version of Perl are you running? Last time I checked, the standard version of Perl on Solaris was 5.8.4. It might be up to 5.8.9 now. The problem is that the feature you want, specifying the option as 'iiles:s{,}' => \@inputFileArray,
probably isn't there in your version of Getopt::Long
.
Run this command:
$ perldoc Getopt::Long
And look for the string coordinates=f{2}
. If you can't find it, you don't have that option.
You can live without it. (There are still ways to specify multiple values), or you can try the Sun Freeware Site and see if they have a later version of Perl, or you can download the latest version of Getopt::Long
from CPAN. However, be careful to make sure that the version you download works with your version of Perl. I've recently noticed that some of the newer modules require features that are found in Perl post 5.10.
Upvotes: 2
Reputation: 97948
It looks like your Getopt::Long
version does not support repeat specifiers. You can update it, or use a comma separated list for example:
GetOptions('iiles:s' => \$fileList);
@inputFileArray = split(/,/, $fileList);
alternatively, use the rest of the arguments in @ARGV
for the list after parsing:
GetOptions('somethings=i'=>\$some);
@inputFileArray = @ARGV;
Upvotes: 3