Just another Perl shrine | |
PerlMonks |
GetOptions getting a stringby ovedpo15 (Pilgrim) |
on Mar 24, 2018 at 18:24 UTC ( [id://1211676]=perlquestion: print w/replies, xml ) | Need Help?? |
ovedpo15 has asked for the wisdom of the Perl Monks concerning the following question:
Hello wise monks! I would like to use Getopt::Long module in to declare a flag which can get one string, many strings or none. I know how to make each one separate, but I don't know how to do all of them. For example: GetOptions("flag=s{,}" => "$flag"); If I run "./perl_script.pl --flag" it will say that I didn't gave it a string. How can I handle this case? I would like that the following code will work: "./perl_script.pl --flag" "./perl_script.pl --flag a" "./perl_script.pl --flag a,b,c,d,e,f"
Back to
Seekers of Perl Wisdom
|
|