[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Re: Neat or horrid?



In article <yzqk8gfkvzm.fsf@compugen.co.il>,
Ariel Scolnicov <ariels@compugen.co.il> wrote:
> I'd try
> 
>      sub sum {@_ ? shift () + goto &sum : 0}
> 
> except that it doesn't work (5.005_03).  I don't think I understand
> why not, though.

Because the C<goto &sum> replaces the current stack frame.
The deepest sum() call returns 0 directly to the original caller
of sum, and no addition is performed.

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe