- or download this
$_ = $parameter;
$parameter =~ /^([0-9]+)d([0-9]+)/;
$n_dice = $1;
$n_sides = $2;
- or download this
$_ = $parameter;
($n_dice,$nsides) = /^(\d+)d(\d+)/;
- or download this
for (my $I=1; $I <= $n_dice; $I++){
$rolls [$I-1] = int(rand($n_sides))+1;
- or download this
for (my $i = 0; $i < $n_dice; $i++) {
$rolls[$i] = int(rand($n_sides))+1;
...
- or download this
for my $i (0..($n_dice-1)) {
$rolls[$i] = int(rand($n_sides))+1;
...
- or download this
return wantarray ? @rolls : $total;