Take a look at __LINE__ (see perldata for details.)
In reply to Re: Determining a line number the error occurs on by adrianh in thread Determining a line number the error occurs on by Anonymous Monk