in reply to HASH PROBLEM

Two glaring problems to start with:
  1. You do foreach my $line (@sorted), and yet you only define @array.
  2. You test for $split[1] and $split[12], and yet each line only has 5 elements, 0 through 4.