Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

( #1932=categorized answer: print w/ replies, xml ) Need Help??

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

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

Comment on Answer: Can I get a subroutine's name from inside the subroutine?
Download Code
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2015-08-03 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (57 votes), past polls