Dru has asked for the wisdom of the Perl Monks concerning the following question:
Yes, this is homework. I can add each number in an array just fine doing this:
But can someone tell me why I can't multiply each element in an array with the folliwing (I'm getting the error message Use of uninitialized value in multiplication (*)):for (@even){ $sum += $_; }
Thanks,for (@odd){ $sum2 *= $_; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Adding and Multplying Elements in an Array
by dug (Chaplain) on Jun 18, 2003 at 01:28 UTC | |
Re: Adding and Multplying Elements in an Array
by djantzen (Priest) on Jun 18, 2003 at 01:43 UTC | |
by Dru (Hermit) on Jun 18, 2003 at 01:47 UTC | |
by Anonymous Monk on Jun 18, 2003 at 12:16 UTC | |
Re: Adding and Multplying Elements in an Array
by tcf22 (Priest) on Jun 18, 2003 at 01:34 UTC | |
Re: Adding and Multplying Elements in an Array
by hmerrill (Friar) on Jun 18, 2003 at 13:40 UTC | |
Re: Adding and Multplying Elements in an Array
by monsieur_champs (Curate) on Jun 18, 2003 at 14:58 UTC |
Back to
Seekers of Perl Wisdom