This is the wrong forum for this kind of question.  But try this instead
it will give you a much clearer picture. 
 
use Getopt::Long; 
use Data::Dumper; 
my %optctl; 
Getopt::Long::GetOptions(\%optctl, 'x!', 'z!') or die \nOption
Error\n\n; 
 
print Dumper(\%optctl),$/; 
 
>>>Vergara, Michael (TEM) <[EMAIL PROTECTED]> 03/25 2:59 pm >>> 
 
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 
 
 

Reply via email to