I'm messing around with Getopt and have a set of arguments that can be
passed to the program. I am new to perl and am unaware of how to
resolve the error while keeping 'use warnings;' enabled. Any help
would be greatly appreciated.
Code:
==============================================
#!/opt/local/bin/perl
use Getopt::Long;
#use diagnostics;
use strict;
use warnings;
my $opts_hash;
my %opts_hash = ();
if (@ARGV < 1)
{
print "argv is less than 1!\n";
print "Exiting...\n";
exit;
}
GetOptions( 'all' => \$opts_hash{allTests},
'CbcDec' => \$opts_hash{CbcDec}, 'CbcEnc' => \$opts_hash{CbcEnc},
'CfbDec' => \$opts_hash{CfbDec}, 'CfbEnc' => \$opts_hash{CfbEnc},
'CtrDec' => \$opts_hash{CtrDec}, 'CtrEnc' => \$opts_hash{CtrEnc},
'EcbDec' => \$opts_hash{EcbDec}, 'EcbEnc' => \$opts_hash{EcbEnc},
'OfbDec' => \$opts_hash{OfbDec}, 'OfbEnc' => \$opts_hash{OfbEnc},
'Sha1Test' => \$opts_hash{Sha1Test}
);
foreach (keys %opts_hash)
{
if ( $opts_hash{$_} == 0 )
{
next;
}
elsif ( $opts_hash{$_} == 1 )
{
print "$_ = $opts_hash{$_}\n";
}
}
==============================================
naiad:~/workspace $ ./debug2.pl --CbcDec
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
CbcDec = 1
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
Use of uninitialized value in numeric eq (==) at ./debug2.pl line 32.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/