next up previous contents
Next: Using a Private Function Up: Functions Previous: Using a List as

Nesting Function Calls

Function calls can be nested many levels deep. Nested function calls simply means that one function can call another which in turn can call another. Exactly how many levels you can nest depends on which version of Perl you are running and how your machine is configured. Normally, you don't have to worry about it. If you want to see how many levels your system can recurse, try the following small program,


sub firstSub{





A system typically counts up to something like 127 before displaying the following message:

Error: Runtime exception

While it is important to realize that there is a limit to the number of times your program can nest functions, you should never run into this limitation unless you are working with recursive mathematical functions.