my $weighted_norm = 0; foreach (@days) { $weighted_norm += $norm_of_the_day * $amount_of_votes_on_this_day / $total_amount_of_votes ; }