“Dynamic Subroutines” is one of my favorite chapters in Mastering Perl, although it’s not a long one. When Allison Randal and I were first planning the book, we didn’t want to cover anything that was already done well in another book. Since Mark Jason Dominus had already exhausted the subject in Higher-Order Perl, I didn’t belabor the point.
Not much has changed in Perl in this regard, although Perl v5.16 added the __SUB__
token so we can reference the current subroutine even if we don’t know its name.
Check out this chapter in O’Reilly Atlas.