[Pdx-pm] Newbie question ... built-in for subroutine name?

Earthlink dcstevens at earthlink.net
Thu Jul 25 15:18:15 CDT 2002


I'm trying to find the perl built-in variable for the current subroutine name (the analog to __FUNCTION__ in gcc), so that I can pass the name to a calling function, as in 
the code below. I've looked through the Coriolis and O'Reilly texts, and at several on-line FAQs. Anyone know what it's called?

    sub foo
    {
        my ($callerName) = @_;
        printf("foo called from $callerName\n");
    }

    sub callingFxn
    {
        my $currentFxnName = ???;
        foo($currentFxnName);
    }





More information about the Pdx-pm-list mailing list