#!/usr/bin/perl # http://perlmonks.org/?node_id=1122584 use Term::ReadLine; use strict; (my $term = new Term::ReadLine 'dierolling')->ornaments(",,,"); print "Input the dice and modifier you want to roll like this: 2d9+100. To quit, press Ctrl-C.\n"; while (1) { defined(my $dice = $term->readline('? ')) or last; my @arr = split (/d/, $dice); my @arr2 = split (/\+/, $arr[1]); for my $i (1 .. $arr[0]){ print ((int(rand($arr2[0] - 1)) + 1 + $arr2[1]), "\n");}}