#! /usr/local/bin/perl use diagnostics ; use warnings ; use strict ; use List::Util qw (sum) ; #not in the standard distro my $roll = 6 ; until ($roll == 0) { #rolls the dice 6 times $roll -- ; my @d61 = int(rand(5) + 2) ; #6 sided die with no 1 my @d62 = int(rand(5) + 2) ; my @d63 = int(rand(5) + 2) ; my @d64 = int(rand(5) + 2) ; my @all = sort #split line for looks { $b <=> $a } @d61, @d62, @d63, @d64 ; #sorts rolls #to prepare for pop @all ; #pop removing #the lowest roll my $sum = sum(@all) ; #before adding print "\n@all - $sum\n" ; }