in reply to Hash sorting
Well it looks like your print statement is just going to print the values. Printing $hash{$key} will print the keys value. Try changing the statement to:
print TESTFILE "$key; $calhash{$key}\n";
And see if that gives you your desired output.
Update: I was beat to the punch twice. :)