I am writing a Perl pipeline, a script that calls various other programs and manages passing data from one to the other. The script (call it
my ($errMsg) = @_;
## various other cleanup tasks here
foo at subroutines.ph line 5.
foo at pipelines.pl line 4.
caller , to do this:
my ($package, $filename, $line) = caller;
gives you the information you need.
However, as you are talking about debugging generally, you can get a complete backtrace from
carp, as mentioned already.