in reply to Re: subroutine calls itself
in thread subroutine calls itself

Perl's stack resides on the heap, so stack consumption is a non-issue (unless XS code is being called recursively).

There could be a difference in general memory consumption between a recursive and a non-recursive solution, but I wouldn't expect it to be major.