Friday, January 8, 2010

Perl One Liner:Fibonacci Series

Now for something little different, I stumbled upon in the net, this one liner prints the Fibonacci series (first 20 numbers).

perl -e'@p=(0,1);until($#p>20){print"$p[-2]\n";push @p,$p[-2]+$p[-1]}'


The power of Perl...

No comments: