On 11/15/2006 03:06 AM, Nigel Peck wrote:

Is there a way to get the name of the current sub?

So:

sub test_sub {
    $subname = ???;
    print $subname; # prints test_sub?
}

Took a look through Programming Perl and Googled it but couldn't find the answer.

TIA
Nigel


$subname = (caller 0)[3];

Read the documents:
Start->Run->"perldoc -f caller"

BTW, thanks for asking this question because it helped me to learn something new.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to