- or download this
sub permutation {
my ($prob, $start) = (1, shift);
$prob *= $start-- foreach (1 .. $_[0]);
$prob;
}
- or download this
sub permutation {
my $prob = 1;
$prob *= $_ foreach ((($_[0]+1) - $_[1]) .. $_[0]);
return $prob;
}
- or download this
sub permutation {
my $prob = 1;
return (map { $prob *= $_ } (($_[0] - $_[1] + 1) .. $_[0]))[-1];
}