in reply to Puzzled by Recursion.
I usually see the Fibonaccis start with 0 (i.e. 0, 1, 1, 2, 3, etc), but that's not crucial. As for the function: if you
pass it 15, then since 15 isn't < 1, the else is executed
and the result is fib(14)+fib(13). But then
this produces fib(13)+fib(12)+fib(12)+fib(11), etc. It's easier to follow a simpler case: give the function 3; then you get fib(2)+fib(1) and then fib(1)+fib(0)+fib(0)+fib(-1). Since fib(1) results in fib(0)+fib(-1), the final result is 5. Your function give for 0,1,2,3,4,... the values 1,2,3,5,8,...
chas
(I shortened fibonacci to fib to save space. It does seem
rather clever that the parser is able to handle functions that
call themselves. I think compilers often implement the
recursion in terms of loops; I don't know what Perl does.)