Re: Determining current function name

2010-12-30 Thread Kenneth Wolcott
On Thu, Dec 30, 2010 at 20:18, Parag Kalra wrote: > Thanks Shawn and Jim. caller(0) did the trick. > > Cheers, > Parag Did you even look at the output of "perldoc -f caller"? Apparently not. So when others tell you the same thing, then you thank them. Nice. Ken Wolcott -- To unsubsc

Re: Determining current function name

2010-12-30 Thread Parag Kalra
Thanks Shawn and Jim. caller(0) did the trick. Cheers, Parag On Thu, Dec 30, 2010 at 8:11 PM, Jim Bauer wrote: > On Thu, 30 Dec 2010 18:30:04 -0800, Parag Kalra wrote: >> Hi, >> >> Just like $0 reveals the current script name is there any variable >> using which I can find the current sub-rou

Re: Determining current function name

2010-12-30 Thread Jim Bauer
On Thu, 30 Dec 2010 18:30:04 -0800, Parag Kalra wrote: > Hi, > > Just like $0 reveals the current script name is there any variable > using which I can find the current sub-routine I am currently in. printf("currently in %s\n", (caller(0))[3] =~ /^.+:(\w+)$/); See `perldoc -f caller'. -

Re: Determining current function name

2010-12-30 Thread Shawn H Corey
On 10-12-30 09:57 PM, Parag Kalra wrote: I have already tried that. Specially - caller(3) but it returns the details of the caller i.e from where it was called and no particular details of where it is in. Have you tried caller(0)? sub foo_bar { my @caller = caller(0); print "@caller\n";

Re: Determining current function name

2010-12-30 Thread Parag Kalra
I have already tried that. Specially - caller(3) but it returns the details of the caller i.e from where it was called and no particular details of where it is in. Cheers, Parag On Thu, Dec 30, 2010 at 6:50 PM, Kenneth Wolcott wrote: > On Thu, Dec 30, 2010 at 18:30, Parag Kalra wrote: >> Hi

Re: Determining current function name

2010-12-30 Thread Kenneth Wolcott
On Thu, Dec 30, 2010 at 18:30, Parag Kalra wrote: > Hi, > > Just like $0 reveals the current script name is there any variable > using which I can find the current sub-routine I am currently in. > > Snippet of what I am looking for: > > use strict; > use warnings; > > sub foo_bar () { >    print "

Determining current function name

2010-12-30 Thread Parag Kalra
Hi, Just like $0 reveals the current script name is there any variable using which I can find the current sub-routine I am currently in. Snippet of what I am looking for: use strict; use warnings; sub foo_bar () { print "You are currently using the function - $\n"; } &foo_bar; Cheers, P