Bryan R Harris wrote:

Is it possible from within a function to get the name of the function I'm
in?  e.g.

**************************************
sub function23 { return "I am in function $<somevariable??>\n"; }

print function23();
**************************************

... should return "I am in function function23"

Does that make sense?

I have properties that vary depending on what function I'm in, and I'm
trying to make the code more modular...

$ perl -le'
sub function23 { return "I am in function ", ( caller 0 )[ 3 ], "\n"; }
print function23();
'
I am in function main::function23


perldoc -f caller



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

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


Reply via email to