rsriram has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am writing a perl script in Win32. If the user enters wrong number of parameters to the script, it has to return a error. My code for this:
if (!@ARGV) { print "Usage: perl $0 <XML filename> <equations file name>\nType $0 h +for Help!\n"; exit(0); }
In the similar way, if the user types h along with the program name, it has to display help. The code for this is:
if(@ARGV="h") { print "Help contents"; exit(0); }
When executing the code, whether I type h or any other character, I get the "Help contents" displayed. Can anyone tell me what's wrong in my code?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help display when executing the script
by GrandFather (Saint) on Aug 08, 2006 at 10:18 UTC | |
|
Re: Help display when executing the script
by davorg (Chancellor) on Aug 08, 2006 at 10:21 UTC | |
by Not_a_Number (Prior) on Aug 08, 2006 at 17:09 UTC | |
|
Re: Help display when executing the script
by Corion (Patriarch) on Aug 08, 2006 at 10:20 UTC | |
|
Re: Help display when executing the script
by dorward (Curate) on Aug 08, 2006 at 10:18 UTC | |
|
Re: Help display when executing the script
by Samy_rio (Vicar) on Aug 08, 2006 at 10:22 UTC | |
by davorg (Chancellor) on Aug 08, 2006 at 10:32 UTC | |
|
Re: Help display when executing the script
by cdarke (Prior) on Aug 08, 2006 at 10:23 UTC |