On Fri, Feb 08, 2002 at 01:00:13PM -0500, Balint, Jess wrote:
> Hello all. I am getting wierd errors on the following piece of code.
Why are they weird warnings? They seem normal to me; you're trying to treat
"" as a number, which is usually wrong, so Perl is warning you about it.
> 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:
Perl does just add "" as 0, the messages you're seeing are warnings, not
errors. To get rid of them default the value:
$freqidx{$key}[$_] += $fields[$vars[$_]] || 0;
> 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.
Michael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]