Re: how to recursion

2017-03-29 Thread PYH
I asked this just b/c I want to do matrix calculation in perl. I found under some conditions a recursion is more effective. Thanks everybody. On 2017/3/29 23:31, Chas. Owens wrote: On Tue, Mar 28, 2017 at 9:27 PM PYH mailto:p...@vodafonemail.de>> wrote: Hi, what's the better way to wr

Fw: how to recursion

2017-03-29 Thread Shlomi Fish
Forwarding to the list. Begin forwarded message: Date: Wed, 29 Mar 2017 11:32:08 -0400 From: Shawn H Corey To: Shlomi Fish Subject: Re: how to recursion On Wed, 29 Mar 2017 17:22:36 +0300 Shlomi Fish wrote: > my_recursion accepts $self as its first argument, so you should pass > it

Re: how to recursion

2017-03-29 Thread Chas. Owens
On Tue, Mar 28, 2017 at 9:27 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? > Define better. In general that is the right

Re: how to recursion

2017-03-29 Thread Shlomi Fish
Hi Shawn! On Wed, 29 Mar 2017 08:09:12 -0400 Shawn H Corey wrote: > On Wed, 29 Mar 2017 09:25:06 +0800 > PYH wrote: > > > sub my_recursion { > > my $self = shift; > > > > if (...) { > > $self->my_recursion; > > # you don't need $self. subroutine lookup starts >

Re: how to recursion

2017-03-29 Thread Shawn H Corey
On Wed, 29 Mar 2017 09:25:06 +0800 PYH wrote: > sub my_recursion { > my $self = shift; > > if (...) { > $self->my_recursion; # you don't need $self. subroutine lookup starts # in the same package. Just the sub by itself # is good enough. my_recursion(); > }

Re: how to recursion

2017-03-28 Thread Uri Guttman
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 w

how to recursion

2017-03-28 Thread PYH
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? thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@per