for (my $i = 0; $i < $n_dice; $i++) { $rolls[$i] = int(rand($n_sides))+1; ...