On 03/28/2017 09:25 PM, PYH wrote:
Hi,
what's the better way to write a recursion in perl's class?
sub my_recursion {
my $self = shift;
....
if (...) {
$self->my_recursion;
}
}
this one?
i am not sure what you mean by better. your code would work if you
finished it with a proper argument check. recursive code must always
have a clean way to end the recursion and pop up the stack. and you
don't need OO to do recursion either. perl supports recursion in general.
uri
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/