12.2 Recursive Functions

12.2  Recursive Functions

  Like most programming languages, Perl allows one to write recursive subprograms. A recursive subprogram is one that calls itself either directly or indirectly. To call directly means that the subprogram calls itself. To call indirectly means that the subprogram calls some subprogram which calls the original subprogram directly or indirectly. Recursive programs are introduced in Section 2.9. There are examples of recursive functions in Chapter 6. The examples deal exclusively with files and directories, and are fairly simple to follow. Since the discussion on recursion in Chapter 6 is extensive, we do not discuss recursive functions here.