mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
Rename samples subdirectories
This commit is contained in:
42
samples/Perl/fib.pl
Normal file
42
samples/Perl/fib.pl
Normal file
@@ -0,0 +1,42 @@
|
||||
#! perl
|
||||
# Copyright (C) 2001-2003, Parrot Foundation.
|
||||
|
||||
=head1 NAME
|
||||
|
||||
examples/benchmarks/fib.pl - Fibonacci Benchmark
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
% time perl examples/benchmarks/fib.pl n
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Calculates the Fibonacci Number for C<n> (defaults to 28 if
|
||||
unspecified).
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub fib {
|
||||
my $n = shift;
|
||||
return $n if ( $n < 2 );
|
||||
return fib( $n - 1 ) + fib( $n - 2 );
|
||||
}
|
||||
my $N = shift || 28;
|
||||
|
||||
print "fib($N) = ", fib($N), "\n";
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
F<examples/benchmarks/fib.pir>.
|
||||
|
||||
=cut
|
||||
|
||||
# Local Variables:
|
||||
# mode: cperl
|
||||
# cperl-indent-level: 4
|
||||
# fill-column: 100
|
||||
# End:
|
||||
# vim: expandtab shiftwidth=4:
|
||||
Reference in New Issue
Block a user