in reply to Modification of a read-only value attempted

You might have something like

if (...) { <- Line number in error message ... } elsif (...) { <- Actual location of the error ... }

Generally, run-time errors use the line number of the start of the statement.

Update: This particular construct seems to give the correct line number since 5.10.