in reply to
The key to understanding recursion is to realize where the my variables that are declared within a sub actually live: “on the stack,” which also contains information needed to return from a subroutine call. When any subroutine calls itself, directly or indirectly, i.e. “recursion,” each instance of the call has its own set of so-called “local” variables.
Thus, any sub can, within a loop controlled by a local variable, call any other sub, including itself, and it Just Works.™