first commit

This commit is contained in:
douboer
2025-09-17 16:08:16 +08:00
parent 9395faa6b2
commit 3ff47c11d5
1318 changed files with 117477 additions and 0 deletions

27
perl/Examples/Chap5/fib-3 Normal file
View File

@@ -0,0 +1,27 @@
###
### fib3
###
## Chapter 5 section 4.3.1
sub fib {
my $n = shift;
my ($s1, $s2, $return);
while (1) {
if ($n < 2) {
return $n;
} else {
if ($BRANCH == 0) {
$return = fib($n-2);
} elsif ($BRANCH == 1) {
$s1 = $return;
$return = fib($n-1);
} elsif ($BRANCH == 2) {
$s2 = $return;
$return = $s1 + $s2;
}
}
}
}