James Edward Gray II wrote:

> On Mar 1, 2004, at 3:59 AM, Gary Stainburn wrote:
>
> > Okay, I can do that simply enough, but could you elaborate on the
> > reason
> > please.
>
> Sure.
>
>         Subroutines may be called recursively.  If a subroutine iscalled using
>
>         the "&" form, the argument list is optional, and if omitted, no @_
>         array is set up for the subroutine: the @_ array at the time of the
>         call is visible to subroutine instead.  This is an efficiency
> mechanism
>         that new users may wish to avoid.
>
> That's a quote from 'perldoc perlsub', which does a far better job of
> explaining these things than I could.  It's worth a look.

I must say, I was sort of mystified, in reading this, as to why one would want
to do this in a recursive subroutine.  I guess it might just be different
recusrion styles.  For me, it is the change in arguments as a subroutine calls
itself that powers the work, and that leads to the stopping case[s].

It might be interesting to see an example of a recursive call that retained its
pparameter list, with or without the use of the syntactic shortcut.

Joseph



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to