Hello warshall, and welcome to the Monastery!
Just to reinforce the explanations given by choroba and tobyink, here is what the Camel Book (4th Edition, page 358) says about Nested subroutines:
If you are accustomed (from other programming languages) to using subroutines nested within other subroutines, each with their own private variables, you’ll have to work at it a bit in Perl. Named subroutines do not nest properly, although anonymous ones do.9
9 To be more precise, globally named subroutines don’t nest. Unfortunately, that’s the only kind of named subroutine declaration we have. We haven’t yet implemented lexically scoped, named subroutines (known as my subs), but when we do, they should nest correctly.
Hope that helps,