Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi All,

Does Perl have an equivalent for Bash's reserved word
"$" that gives the name of your sub?


Re: $

Quoted text here. Click to load it

If you're in a subroutine, the expression


will return the name of the current subroutine. 'caller' returns a list
with various bits of context information and the subroutine name is the
3rd element of this list. For more details, see

perldoc -f caller

Re: $

On 08/12/2015 11:33 AM, Rainer Weikusat wrote:
Quoted text here. Click to load it

Hi Rainer,

Thank you!

I DuckDuck'ed go all over the place.  I just did not know
how to ask the question.

I use $ to pass the name of the parent sub to
a helper sub (called by many) so I can see the trail of
who called whom in my verbose/diagnostic outputs.

-T  (Todd)

Site Timeline