Multiply each element of an array to each other
I have an array of float numbers: (.25, .45, .15, .27). I would like to
multiply each element with each other than divide by the number of array
elements.
foreach my $element (@array)
{
my $score = $score * $element;
}
$score = $score/$numofelements;
This produces the value 0. Not sure if my syntax is correct.
No comments:
Post a Comment