The book ``Programming Perl'' 3rd edition by L.Wall, T. Christiansen
and J.Orwant (also known as the ``Camel'' book, named after the camel
picture on the cover of the book). You want to refer to Chapter 8 that
talks about nested subroutines among other things.