FAQ

Vergara, Michael (TEM) 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

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 5 | next ›
Discussion Overview
groupdbi-users @
categoriesperl
postedMar 25, '05 at 9:59p
activeMar 27, '05 at 5:28a
posts5
users4
websitedbi.perl.org

People

Translate

site design / logo © 2022 Grokbase