foreach my $j (@brray) {   foreach my $i (@array)   {      $sum += $i;      $sum *= $j;  } }