start: die /^\Z/ {$item {die}} die: 'd' faces {1 + int rand $item {faces}} | count 'd' faces {my $s = 0; foreach (1 .. $item {count}) { $s += 1 + int rand $item {faces} } $s} count: number faces: number number: /\d+/