in reply to Trick die rolling

I would say something like:
use strict; my @rolls; foreach (0..3){ my $roll = 1; while ($roll == 1) { $roll = int(rand(6) + 1) ; } $rolls[$_]= $roll; } @rolls =reverse sort @rolls; pop @rolls; print @rolls; &AddRolls(\@rolls);
I leave the AddRolls sub as an exercise for the reader.

C-.