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[$_]; }