in reply to fibo's 66 chars
You can save yourself a couple of characters by using pop instead of shift.
Also, if you use -l, you can get rid of the quotes and newline:
$a=pop;@b=(0,1);push@b,$b[-2]+$b[-1]while$#b<$a;print$b[-2]
Then, you can cut down the while$#b<$a by using for(2..$a):
$a=pop;@b=(0,1);push@b,$b[-2]+$b[-1]for(2..$a);print$b[-2]
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: fibo's 66 chars
by Roy Johnson (Monsignor) on May 27, 2009 at 21:17 UTC |