Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: How can a subroutine get its name?

by clemburg (Curate)
on Sep 03, 2001 at 20:56 UTC ( [id://109894]=note: print w/replies, xml ) Need Help??


in reply to How can a subroutine get its name?

caller() is the function you want. A subroutine can get its own name like this:

perl -e 'sub try { print +(caller(0))[3] }; try() '

Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://109894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-03-28 20:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found