But this routine sets up an infinite loop as far as I can tell. When I added a quick print "$_[0],$_[1]" to the beginning of the sub, the output led me to believe the problem here is the algorithm itself, not the technique used to save stack space. Am I missing something?