in reply to How to determine current line executing in Script

Also see perldata about __LINE__, and possibly caller, should you want to put your logging code into a subroutine.