in reply to How do I multiply the corresponding elements in two arrays together?

I hate to use array indices, but here's one way:
my @Products = map {$Arr1[$_] * $Arr2[$_]} 0..$#Arr1;
This assumes that the arrays @Arr1 and @Arr2 exist and are the same length.
  • Comment on Re: How do I multiply the corresponding elements in two arrays together?
  • Download Code