js1 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I have the following code in my script test.pl which gets command line options.
getopts("ciphdvs:",\%opts); ## help if($opts{h}){
I can run the script without any options, but if it's run with an option that's not available, e.g. 'test.pl -b' I want to print the help message. How can I test for an undefined option?
Thanks for any help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: test for unknown option in getopts
by gellyfish (Monsignor) on Aug 18, 2006 at 09:43 UTC | |
by GrandFather (Saint) on Aug 18, 2006 at 09:46 UTC | |
by js1 (Monk) on Aug 18, 2006 at 09:50 UTC |