in reply to Re^2: How Do I Get the Line Number In My Error Message?
in thread How Do I Get the Line Number In My Error Message?

my intention is to get the caller line number, how can I do that ?
  • Comment on Re^3: How Do I Get the Line Number In My Error Message?

Replies are listed 'Best First'.
Re^4: How Do I Get the Line Number In My Error Message?
by xdg (Monsignor) on Nov 03, 2005 at 15:49 UTC

    Read the docs for caller.

    ($package, $filename, $line, $subroutine, $hasargs, $wantarray, $evaltext, $is_require, $hints, $bitmask) = caller($i);

    You may also want to read "Plain Old Comments (Not!)" and the end of perlsyn -- you can manipulate the file and line numbers that Perl reports.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.