in reply to Sort and Compare Files

If you "use strict", you will find that you have $y = pop @sections||''; where sections is never defined.

Also, before the comparison loop, you have $x = pop @unsorted, but in the loop you have $x = pop @sorted

Also, in the comparison loop you are replacing the larger value. When you do cosequential processing, you must replace the smaller value. Unless, of course, your input is sorted in descending order.

When you replace the smaller value you are going to have problems with your use of '' to indicate end of list. Instead you may want to use something like "\xff" x 20.

Updated: Oh, you are using pop instead of shift, so your lists are effectively sorted in descending order.