http://www.perlmonks.org?node_id=1027266


in reply to Finding what called a subroutine

Yes, you can use caller:
($pkg, $file, $line) = caller(1);
Or see Carp's croak() and confess().

Replies are listed 'Best First'.
Re^2: Finding what called a subroutine
by pemungkah (Priest) on Apr 06, 2013 at 10:11 UTC
    Very much recommend caller(), as educated_foo says; you can get a full stack trace all the way back to the main program if you need it.