in reply to Determining a line number the error occurs on

__LINE__ aside, you could use warn (with a suitably redirected STDERR or $SIG{__WARN__}) with no trailing newline and Perl will add the location for you.