<commit_before>#!/usr/bin/perl -w -I /home/msmud/lib/lib/perl5/site_perl/5.10.0/

# quick and dirty by :pragma

use Games::Dice qw/roll roll_array/;

my ($result, $rolls, $show);

if ($#ARGV <0)
{
  print "Usage: roll [-show] <dice roll>; e.g.: roll 3d6+1. To see all individual dice rolls, add -show.\n";
  die;
}

$rolls = join("", @ARGV);

if($rolls =~ s/\s*-show\s*//) {
  $show = 1;
}

if($rolls =~ m/^\s*(\d+)d\d+\s*$/) {
  if($1 > 100) {
    print "Sorry, maximum of 100 rolls.\n";
    die;
  }
} else {
  print "Usage: roll [-show] <dice roll>; e.g.: roll 3d6+1. To see all individual dice rolls, add -show.\n";
  die;
}

if($show) {
  my @results = roll_array $rolls;
  $result = 0;<commit_msg>Update dice_roll.pl to accept +n modifier<commit_after>#!/usr/bin/perl -w -I /home/msmud/lib/lib/perl5/site_perl/5.10.0/

# quick and dirty by :pragma

use Games::Dice qw/roll roll_array/;

my ($result, $rolls, $show);

if ($#ARGV <0)
{
  print "Usage: roll [-show] <dice roll>; e.g.: roll 3d6+1. To see all individual dice rolls, add -show.\n";
  die;
}

$rolls = join("", @ARGV);

if($rolls =~ s/\s*-show\s*//) {
  $show = 1;
}

if($rolls =~ m/^\s*(\d+)d\d+(?:\+\d+)?\s*$/) {
  if($1 > 100) {
    print "Sorry, maximum of 100 rolls.\n";
    die;
  }
} else {
  print "Usage: roll [-show] <dice roll>; e.g.: roll 3d6+1. To see all individual dice rolls, add -show.\n";
  die;
}

if($show) {
  my @results = roll_array $rolls;
  $result = 0;
{'fraction_non_alphanumeric': 0.2236842105263158, 'fraction_numerical': 0.029085872576177285, 'mean_word_length': 2.9373297002724796, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2601054', 'n_tokens_mistral': 667, 'n_tokens_neox': 632, 'n_words': 168}