Vergara, Michael (TEM) [mailto:[EMAIL PROTECTED] wrote:
> 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";
> 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?
This is not a DBI question. Please ask your questions in the appropriate
forum.
Since I'm feeling helpful at the moment, I will point out that you are
checking whether the option is true; you should be checking whether it
exists.
if ( exists $optctl{z} ) {
HTH,
Ronald