http://www.perlmonks.org?node_id=1052327


in reply to Deep recursion on subroutine

From the theoretical perspective, you can be never sure. But, in practice, your computer will run out of memory far before going into infinite recursion. If you can find an upper bound of the depth (e.g. the size in bytes of the input file), you can check whether your current depth is not beyond the bound.
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ