11 lines
165 B
Perl
11 lines
165 B
Perl
|
sub factorial
|
||
|
{
|
||
|
my $value = shift (@_);
|
||
|
|
||
|
return $value == 1 ? $value : $value * factorial ($value - 1);
|
||
|
|
||
|
}
|
||
|
|
||
|
$result = factorial(6);
|
||
|
|
||
|
print $result;
|