in reply to Determining a line number the error occurs on
Take a look at __LINE__ (see perldata for details.)