in reply to Use of uninitialized value in array element

If you're getting the expected results and know for certain that the values may not be initialized then you can just turn off warnings in that area e.g
{ no warnings 'uninitialized'; for(0..3) { ($sums[$i])->[$_][$j] += $vals[$_+1]; if($ts >= 21) { $sums[$i]->[4][$j] += $vals[5]; $sums[$i]->[5][$j] += $vals[6]; } } $totals[$i]->[$j]->[0]++; }
I really don't recommend doing this every time you get an uninitialized error, but if you expect there to be uninitialized values and it's a hassle to initialize them (see. chance for more bugs to creep in) then this can be very handy.
HTH

_________
broquaint

Replies are listed 'Best First'.
Re: Re: Use of uninitialized value in array element
by dimmesdale (Friar) on Jul 12, 2002 at 15:27 UTC
    What is it referring to about initialized, though? The @vals array is all there (all initialized). THe @sums array is initialized all to zero in the beginning. I thought maybe it meant the $i, $_, $j indices, but they too all have values.

    (Also, I'm getting incorrect results; this may be a result of another part of the code, though)

    Update: Shoot... didn't hit stop in time. If someone sees this with the right 'power', can they delete the above node (it was "truly a duplicate" with some info left out...)