Dotfiles, utilities, and other apparatus.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
445 B

  1. #!/usr/bin/env perl
  2. # roll some dice
  3. use utf8;
  4. use open ':std', ':encoding(UTF-8)';
  5. use strict;
  6. use warnings;
  7. use 5.12.0;
  8. use Scalar::Util;
  9. my $count = 1;
  10. if (defined $ARGV[0] && Scalar::Util::looks_like_number($ARGV[0])) {
  11. $count = $ARGV[0];
  12. }
  13. my $sum = 0;
  14. my @faces = ('⚀', '⚁', '⚂', '⚃', '⚄', '⚅');
  15. for (1..$count) {
  16. my $face = int(rand @faces);
  17. $sum += ($face + 1);
  18. print $faces[$face] . " ";
  19. }
  20. print "($sum)\n";