in reply to simultaneously adding and multiplying numbers in a hash/ array

The hash is neither required nor helpful.
my @change = (1.15, -0.1, 5.4, 1.03, -0.241); my @numberofshares = (100, 400, 200, 300, 240); my $product = 0; for (0..$#change) { $product += $change[$_] * $numberofshares[$_]; }
  • Comment on Re: simultaneously adding and multiplying numbers in a hash/ array
  • Download Code