On 2017-02-04 12:34 AM, ToddAndMargo wrote:
Hi All,
Just out of curiosity, in Perl 6 can a subroutine call itself?
-T
I am fighting with a broken Net:FTP::rmdir in Perl 5 that
will not recuse as advertised (it is very intermittent).
And I can not use Net::Ftp in Perl 6 as it is hosed and
so is the Inline.
And it seems that Perl 5 doesn't like me calling myself,
which would do wonders for looping on rmdir until I get
everything.
On 02/04/2017 12:51 AM, Darren Duncan wrote:
Any decent programming language supports self-recursion, where a
subroutine may invoke itself. Perl 6 explicitly also supports this,
and even has a special keyword for a routine to refer to itself
without knowing its own name, especially useful for anonymous subs; I
don't remember that keyword but it may have been something like "SUB"
or "SELF". -- Darren Duncan
Are there any special rules, like in Perl 5? Do I need to pre-declare
the sub?
sub BummerDude ($);
sub BummerDude ($) { do something; }
-T