Hi,
I am unable to get the following inherited code, using
Getopt::Long, to work.
It is my understanding that Perl will automatically
create a $opt_help variable ( for a -help command line
option). However, when I try to print it's value, it
returns a null value. In addition, the "help" mesage
is never printed.
Here is the output of the program, when I run it:
%perl gtopt.pl -help
The value of $opt_help is :
Any help and pointers on what might be wrong would be
greatly appreciated.
Thanks
PN
---------- Source Code ----------
#/usr/bin/perl -w
use strict;
##### Forward declarations
my $opt_help;
sub GetCmdLine;
##### Begin of Main Body
&GetCmdLine();
##### End of Main Body
##########################
#### Sub GetCmdLine ####
##########################
sub GetCmdLine {
use Getopt::Long;
$Getopt::Long::ignorecase;
$Getopt::Long::autoabbrev;
&GetOptions("help|h");
##### Print the value of $opt_help
print "The value of \$opt_help is : ",
$opt_help, "\n";
if (defined($opt_help) && ($opt_help ==1)) {
print "\n\nUsage: $0 [options] \n";
print " [optins]:\n";
print "\t\t-h Prints this help message
header.....\n";
}
}
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]