|
|
- #!/usr/bin/env perl
-
- # roll some dice
-
- use utf8;
- use open ':std', ':encoding(UTF-8)';
-
- use strict;
- use warnings;
- use 5.12.0;
-
- use Scalar::Util;
-
-
- my $count = 1;
- if (defined $ARGV[0] && Scalar::Util::looks_like_number($ARGV[0])) {
- $count = $ARGV[0];
- }
-
- my $sum = 0;
- my @faces = ('⚀', '⚁', '⚂', '⚃', '⚄', '⚅');
- for (1..$count) {
- my $face = int(rand @faces);
- $sum += ($face + 1);
- print $faces[$face] . " ";
- }
-
- print "($sum)\n";
|