in reply to Error when running on larger files

You are hitting the limit on something.

You should be able to pinpoint the record number just prior to these errors occurring and have some print statements occur so that you know whether the values of $F2[2] and the other variables are reasonable and then you can watch one or more of them suddenly go haywire.

The good thing is that the error is reproducible.

By the way, "Mastering Algorithms with Perl" has a detailed chapter on every sort algorithm available in Perl (at the time it was printed).