Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Use of uninitialized value in addition

by kiruthika.bkite (Scribe)
on Mar 26, 2010 at 04:12 UTC ( #831023=note: print w/replies, xml ) Need Help??


in reply to Use of uninitialized value in addition

Before performing addition operation ,check whether that array index is having value or not using define function.

Your code,
for my $valNum (0 .. $total){ $mean += $value[$valNum]; }
Change the loop like the following,
for my $valNum (0 .. $total-1){ if(defined($value[$valNum])) { $mean += $value[$valNum]; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://831023]
help
Chatterbox?
[LanX]: talking about destruction of diving spots
[LanX]: Nodes to consider
[erix]: oops - got to run, see you later
[robby_dobby]: erix: 'appy day'ving

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2017-04-24 16:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (442 votes). Check out past polls.