Hi all,
 
Just a quick question and a couple of lines of really simple code.... 
 
use Getopt::Long;
 
...
 
GetOptions ('h'   => \$h,
            'b=s' => \$s );

Sub ShowHelp() {
  print "this is help"
}

Sub DoSomethingWithString() {
...
}

If ($s) {
  DoSomethingWithString();
} else {
  ShowHelp();
}
 
Right.  Now, whilst the above is not perhaps 100% correct, it goes about a
generality of Getopt::Long.

If I now run the application,
./blah.pl -h   - I get the help screen
./blah.pl -s   - I get a error, complaining that -s requires a value, and
THEN the help screen.
./blah.pl -s s - Everything is fine.

So, this is more of a block question I think, but how I can get the above
example to show the help screen FIRST, and THEN complain about the missing
value for -s ????

Thanks,
 
 
--
Regards,
Chris.
 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to