Un simple ejemplo de la Sucesion Fibonacci en Perl.
El codigo :
El codigo :
Código:
# !usr/bin/perl
# Sucesion Fibonacci
# Coded By Doddy Hackman in the year 2014
head();
print "\n\n[+] Enter count : ";
chomp( my $cantidad = <stdin> );
print "\n";
my ( $uno, $dos ) = ( "0", "1" );
for my $num ( 0 .. $cantidad ) {
print "[+] : " . $uno . "\n";
my $final = $uno + $dos;
$uno = $dos;
$dos = $final;
}
copyright();
<stdin>;
exit(1);
# Functions
sub head {
print "\n-- == Fibonacci Sequence == --\n";
}
sub copyright {
print "\n\n-- == (C) Doddy Hackman 2014 == --\n";
}
# The End ?