Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Application using random

package MyRandomApp;
use strict;
use warnings;

use Exporter qw(import);
our  @EXPORT_OK = qw(dice);

sub dice {
    my ($n) = @_;
    return 1 + int(rand() * $n);
}

1;

use strict;
use warnings;
use 5.010;

use MyRandomApp qw(dice);

say dice(6);
say dice(6);
say dice(6);

perl -Ilib bin/dice.pl