in reply to modify the order a list with the help of a hash table

sort returns the sorted list. It doesn't modify the argument.

@KEYS = sort(@KEYS);

Furthermore, since you're converting the timestamps to numbers, you want to do a numerical comparison instead of a lexical comparison.

@KEYS = sort { $a <=> $b } @KEYS;

But you could simply use $Elements[5] as the keys and a lexical comparison.

Update: By the way, here's another way of doing what you want (fast):

my @triee = map { substr($_, 8) } sort map { (split(/;/, $_))[5] . $_ } <INFILE>; foreach my $triee (@triee) { print OUTFILE $triee; }