in reply to How to fix error: Modification of a read-only value

Then and now, you haven't shown us the (reduced) code and the (relevant) data that reproduce the error you're getting. Please reduce your code to a self contained (say, 20 line) script, and supply sample data (say, 5 items), so we can look at it all.

From the error message, my guess is that somewhere in your code (Perl tells you the line number, but you keep it from us as if it's some secret), you're modifying a read-only value. Normally, Perl catches such attempts right away:

perl -e "print 1++" Can't modify constant item in postincrement (++) at -e line 1, near "1 +++" Execution of -e aborted due to compilation errors.

... but you can be more tricky and then Perl can't detect such errors until you execute the code:

sub incr { $_[0]++ }; incr($foo); incr(1);

Maybe you are trying to assign to other read-only values, like $1 or something. We don't know, and it's quite hard to guess without seeing the code.