#!/usr/local/bin/perl -w use DiceDistribution qw(get_distribution); use strict; my @dist = get_distribution(join " ", @ARGV); my $total = 0; for my $roll ($dist[0] ... $dist[1]) { printf "% 4d:% 10d\n", $roll, $dist[$roll-$dist[0]+2]; $total += $dist[$roll-$dist[0]+2]; } print "Total: $total\n";