#!/usr/bin/perl use strict; use warnings; while (<>){ next unless my ($number, $sides) = ($_ =~ /^(\d+)d(\d+)$/); my $total = 0; for (1..$number){ my $roll = int(rand($sides)+1); print "$roll "; $total += $roll; } print "($total)\number"; }
In reply to Re: Six-side dice roll calculator
by rpanman
in thread Six-side dice roll calculator
by Scott7477
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |