use Game::Die::Dice; my $input = "1D4x10"; my ($pass_to_module, $mult) = split('x', $input); $mult = defined($mult) ? $mult : 1; my $dice = new Games::Die::Dice($pass_to_module); my $treasure -= $mult * $dice->roll();
Alternatively, submit a patch to the maintainers of that module so that it accepts multipliers. Something to consider though: what about rolls like "1d4x10+10"? Your current approach probably doesn't handle this...
thor
Feel the white light, the light within
Be your own disciple, fan the sparks of will
For all of us waiting, your kingdom will come
In reply to Re^3: D20 dice throw parser
by thor
in thread D20 dice throw parser
by Luca Benini
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |