When calling a function in recursion we have to be careful to check the stop condition before we call the recursion. If not, we can end up with an infinite recursion that will end only when we have exhausted the resources of our computer.

In order to protect the user from never ending recursions, perl has a hard limit on the number of recursion and if you reach that limit you'll get a warning: Deep recursion on subroutine. The rather arbitrary limit is 100.

Let's see an example.