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.


In reply to Re: How to fix error: Modification of a read-only value by Corion
in thread How to fix error: Modification of a read-only value by Gnat53

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.