#!/opt/local/bin/perl use strict; # Implementation of simple Fibonacci number finding # Copyright Dan DeBlasio 2012 # Created 29 Sept 2012 # get the input number from command line my $number = shift; # set Fib_1 and Fib_2 my @fib = (1,1); # calculate all fib numbers up to the one we want to find for(my $i=2;$i<$number;$i++){ $fib[$i] = $fib[$i-1] + $fib[$i-2]; } # print solution print "The $number-th fibbonacci number is: ".$fib[$number-1]."\n";