in reply to
Never lock $0 inside of a BEGIN block
This example here would have been much easier to figure out if it showed the last line, or the line where the quote began.
Two things: it's not feasable to determine where a quote is
missing, and hence where the unterminated string begins.
However, in many occasions, perl manages to make an educated
guess that's often quite right.
Furthermore, I completely disagree with your statement Perl
has miserable error messages. Perl errors seldom baffle me,
and usually it's immediate clear where the problem is. In cases where it's not clear, it's almost always me not spotting the error instead of perl being wrong.