diff options
Diffstat (limited to 'sample/fib.pl')
-rw-r--r-- | sample/fib.pl | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/sample/fib.pl b/sample/fib.pl index c5593764aa..945a4929a7 100644 --- a/sample/fib.pl +++ b/sample/fib.pl @@ -1,10 +1,11 @@ - sub fib { - local($n)=@_; - if( $n<2 ){ - return $n; - } { - return &fib($n-2)+&fib($n-1) - } - } +sub fib { + my($n)=@_; + if ($n<2) { + return $n; + } + else { + return fib($n-2)+fib($n-1); + } +} - print &fib(20), "\n"; +print fib(20), "\n"; |