Hi Experts,
I am running a perl script which uses GetOpt::Long
giveinfo.pl -name mike -long
where, -name option ("name=s") needs a mandatory string argument
-long is optional flag if set, will provide more details of the user named mike
If i miss the user name while running giveinfo.pl as below then it does not error out -
giveinfo.pl -name -longIn this case, its treating -long as user name and DOES NOT error out. I want that in above case it should error out and say "Option name requires an argument".
FYI. in the below scenario it error out as expected if i use -name at the end of command line -
giveinfo.pl -long -name Option name requires an argument
Can someone please help how can i error out correctly in the below scenerio which is missing name mike -
giveinfo.pl -name -longI don't want to use "=" as -
giveinfo.pl -name= -long
Thanks and Regards,
HarryIn reply to getopt::long treating option as an argument by harpreetsammi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |