in reply to subroutine calls itself

Recursive subroutines can produce large amounts of stack-consumption, but otherwise they are a well-accepted strategy for solving many kinds of problems. If the program that you have works acceptably well, given the volume and nature of the inputs that you have and the capacity of the machinery you have, “all is well.”

Replies are listed 'Best First'.
Re^2: subroutine calls itself
by ikegami (Patriarch) on Jan 09, 2009 at 17:43 UTC

    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.