Misunderstood use of Getopt::long
From: Michael \ Vergara (mvergara_at_guidant.com)
Date: 03/25/05
- Next message: Ronald J Kimball: "RE: Misunderstood use of Getopt::long"
- Previous message: Ron Reidy: "RE: (Fwd) DBI support for executing SQL scripts"
- Next in thread: Ronald J Kimball: "RE: Misunderstood use of Getopt::long"
- Reply: Ronald J Kimball: "RE: Misunderstood use of Getopt::long"
- Maybe reply: Ian Harisay: "Re: Misunderstood use of Getopt::long"
- Reply: Tim Bunce: "Re: Misunderstood use of Getopt::long"
- Maybe reply: Michael \ Vergara: "RE: Misunderstood use of Getopt::long"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 25 Mar 2005 13:59:05 -0800 To: <dbi-users@perl.org>
Hi All:
I have this code...
#!/opt/perl64/bin/perl -w
# v5.8.4 built for PA-RISC2.0-LP64
use Getopt::Long;
my %optctl = ();
Getopt::Long::GetOptions( \%optctl, "x!", "z!")
or die "\nOption Error\n\n";
my( $headerFlag, $duplexFlag );
if ( $optctl{z} ) { $headerFlag = $optctl{z}; }
else { $headerFlag = 1 };
if ( $optctl{x} ) { $duplexFlag = $optctl{x}; }
else { $duplexFlag = 0 };
print "header = $headerFlag\n";
print "duplex = $duplexFlag\n";
When I run it, I get this:
$ ./p
header = 1
duplex = 0
$ ./p -x
header = 1
duplex = 1
$ ./p -x -noz
header = 1
duplex = 1
$ ./p -nox -noz
header = 1
duplex = 0
My problem is that header is always 1 and I don't think it should be
when I specify "-noz". If I can toggle the value of the 'x' option,
why not the 'z' option?
What am I not seeing?
Thanks,
Mike
--- ====================================================================== Michael P. Vergara Oracle DBA Guidant Corporation www.guidant.com
- Next message: Ronald J Kimball: "RE: Misunderstood use of Getopt::long"
- Previous message: Ron Reidy: "RE: (Fwd) DBI support for executing SQL scripts"
- Next in thread: Ronald J Kimball: "RE: Misunderstood use of Getopt::long"
- Reply: Ronald J Kimball: "RE: Misunderstood use of Getopt::long"
- Maybe reply: Ian Harisay: "Re: Misunderstood use of Getopt::long"
- Reply: Tim Bunce: "Re: Misunderstood use of Getopt::long"
- Maybe reply: Michael \ Vergara: "RE: Misunderstood use of Getopt::long"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|