Save multiple values of a command line option in Perl array -


i have script needs take options, 1 of these -i (input). tried following code input parameters array:

#!/usr/bin/perl  use strict; use warnings; use getopt::long;  @input = (); $help = ''; $other = '';  getoptions(     'help'          =>  \$help,     'input=s{1,}'   =>  \@input,     'other=s'       =>  \$other ); 

when try run ./my_script.pl -i param1 param2 -o aaa this:

error in option spec: "input=s{1,}" 

if run explicitly perl perl my_script.pl -i param1 param2 -o aaa works smoothly. there way these parameters array (not using @argv) without explicitly invoking perl command line?

turns out have more 1 version of perl installed. 1 of them (the older one) has older version of getopt::long module doesn't support input=s{1,} syntax. when switched invoking perl up-to-date version installed, script ran no errors.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -