Re: Use of uninitialized value in numeric eq (==)

2007-12-13 Thread Paul Lalli
On Dec 12, 9:45 pm, [EMAIL PROTECTED] (Dr.Ruud) wrote: > protoplasm schreef: > > > foreach (keys %opts_hash) > > { > > if ( !defined $opts_hash{$_} ) > > { > > next; > > } > > elsif ( $opts_hash{$_} == 1 ) > > { > > print "$_ = $opts_hash{$_}\n"; > > } > > } > > An alternative w

Re: Use of uninitialized value in numeric eq (==)

2007-12-12 Thread Dr.Ruud
protoplasm schreef: > foreach (keys %opts_hash) > { > if ( !defined $opts_hash{$_} ) > { > next; > } > elsif ( $opts_hash{$_} == 1 ) > { > print "$_ = $opts_hash{$_}\n"; > } > } An alternative way to write that: for (sort keys %opts_hash) { next unless defined $opts_hash

Re: Use of uninitialized value in numeric eq (==)

2007-12-12 Thread protoplasm
Thanks for the advice. After I posted I tried this and it worked too: foreach (keys %opts_hash) { # This next line of code eliminates the "Use of uninitialized value in # numeric eq (==)" error when 'use warnings;' is enabled. if (

Re: Use of uninitialized value in numeric eq (==)

2007-12-12 Thread John W . Krahn
way that will not autovivify all the keys is: GetOptions( \my %opts_hash, 'allTests', 'CbcDec', 'CbcEnc', 'CfbDec', 'CfbEnc', 'CtrDec', 'CtrEnc', 'EcbDec', 'EcbEnc', 'OfbDec', 'OfbEnc',

Re: Use of uninitialized value in numeric eq (==)

2007-12-12 Thread Chas. Owens
On Dec 11, 2007 7:53 PM, protoplasm <[EMAIL PROTECTED]> wrote: snip > my $opts_hash; > my %opts_hash = (); snip You don't need $opts_hash (you aren't using it). You can get rid of the undef warnings by making sure that the keys in %opts_hash are used like this: #default values for the options my

Use of uninitialized value in numeric eq (==)

2007-12-12 Thread protoplasm
each (keys %opts_hash) { if ( $opts_hash{$_} == 0 ) { next; } elsif ( $opts_hash{$_} == 1 ) { print "$_ = $opts_hash{$_}\n"; } } ========== naiad:~/workspace $ ./debug2.pl --CbcDec Use of unini