tests/perl/common/src/fibo.pl

#!/usr/local/bin/perl
# $Id: fibo.pl,v 1.2 2003/12/30 01:21:23 davidw Exp $
# http://www.bagley.org/~doug/shootout/

# END COMMENT
use strict;
use integer;

# from Leif Stensson
sub fib {
    return $_[0] < 2 ? 1 : fib($_[0]-2) + fib($_[0]-1);
}

my $N = ($ARGV[0] < 1) ? 1 : $ARGV[0];
my $fib = fib($N);
print "$fib\n";

Generated by GNU enscript 1.6.3.