Question d’entretien chez Meta

Write a method to generate the Fibonacci series

Réponse à la question d'entretien

Utilisateur anonyme

9 juil. 2011

perl: fibonacci(10); sub fibonacci{ my $n = shift; my $prev =0; my $this =1; my $count=0; print "$prev\n"; while($count<$n){ print "$this\n"; my $next = $this + $prev; $prev = $this; $this = $next; $count++; } }