Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Answer: Can I get a subroutine's name from inside the subroutine?

by vroom (Pope)
on Jan 10, 2000 at 10:04 UTC ( #1932=categorized answer: print w/replies, xml ) Need Help??

Q&A > subroutines > Can I get a subroutine's name from inside the subroutine? - Answer contributed by vroom

use the caller function:
sub foo { my $this_subs_name = (caller(0))[3]; }