That errors seems to be quieted. THank you. Now, there is this

114:  foreach( sort( keys( %freqidx ) ) ) {
115:          print( "$_|" );
116:          print( "$_|" ) foreach( @{$freqidx{$_}} );
117:          print( "\n" );
118:  }


I get the error:

Use of uninitialized value at ../20020128/pasummary.pl line 114.
Use of uninitialized value at ../20020128/pasummary.pl line 114.

I understand this also may be because I have warnings on, but I am also
trying to understand why line 114 is flagged?

-----Original Message-----
From: Chas Owens [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 08, 2002 1:36 PM
To: Balint, Jess
Cc: perl beginners
Subject: RE: Wierd Error


Looks like it.  I ran

perl -e '$i = 1; $j = undef; print $i + $j, "\n"'

and got

1

then

perl -we '$i = 1; $j = undef; print $i + $j, "\n"'

and got

Use of uninitialized value in addition (+) at -e line 1.
1

and finally

perl -we '$i = 1; $j = undef; no warnings; print $i + $j, "\n"'

and got

1


On Fri, 2002-02-08 at 13:18, Balint, Jess wrote:
> Will this also stop warnings from undefined values? So maybe I could take
> out the if..defined line and it would still add 0 if the value is
undefined?
> Thanks.
> 
> -----Original Message-----
> From: Chas Owens [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 08, 2002 1:20 PM
> To: Balint, Jess
> Cc: '[EMAIL PROTECTED]'
> Subject: Re: Wierd Error
> 
> 
> Obviously you have been a good programmer and turend on warning (either
> with -w or use warnings).  What you are seeing is not an error; it is a
> warning.  Warnings are good because they help you find places where you
> did something wrong, but sometimes you do mean to do a dangerous thing. 
> In those cases you can say something like this
> 
> no warnings;
> $freqidx{$key}[$_] += $fields[$vars[$_]];
> use warnings;
> 
> On Fri, 2002-02-08 at 13:00, Balint, Jess wrote:
> > Hello all. I am getting wierd errors on the following piece of code. >
> > 
> > 95:        for( 0..$#vars ) {
> > 96:                if( defined( $vars[$_] ) ) {
> > 97:                        $freqidx{$key}[$_] += $fields[$vars[$_]];
> > 98:                }
> > 99:        }
> > 
> > @vars are all numberic values and some values of @fields are "". Can
> > $fields[$n] be defined as ""? Shouldn't perl just add "" as 0? The
errors
> > are as follows:
> > 
> > Argument "" isn't numeric in add at ../20020128/pasummary.pl line 96,
> > <INFILE> chunk 4258.
> > Argument "" isn't numeric in add at ../20020128/pasummary.pl line 96,
> > <INFILE> chunk 17733.
> > 
> > Any help would be greatly appreciated. THanks.
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> -- 
> Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168
> Frink!
> 
> Missle Address: 33:48:3.521N  84:23:34.786W
-- 
Today is Prickle-Prickle the 39th day of Chaos in the YOLD 3168
Kallisti!

Missle Address: 33:48:3.521N  84:23:34.786W

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to