Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: Sorting array, getting modification of read-only value errorby thundergnat (Deacon) |
on Nov 28, 2012 at 19:54 UTC ( [id://1006095]=note: print w/replies, xml ) | Need Help?? |
What tobyink++ said. You are filling your @S array starting at index 1 ($v=1;). But arrays are (by default) zero indexed, so $S[0] has nothing in it. Sort then tries to auto-vivify values for $S[0] and gives you an error. Minimal "fix" is to index $v from 0. You have many, many other sub-optimal things in there too though.
In Section
Seekers of Perl Wisdom
|
|