Created
February 4, 2020 12:35
-
-
Save yusukebe/30f73c9de9ba37db7f1a438896abb2da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v5.16; | |
use strict; | |
use warnings; | |
sub fib { | |
my $n = shift; | |
if ($n == 0 || $n == 1) { | |
return $n; | |
}else{ | |
return fib($n-1) + fib($n-2); | |
} | |
} | |
say join(', ', map { fib($_) } 1..10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment