Tu peux utiliser un array stockant l'ordre de tes clés


push @ordre, $row[2];
$x1{$row[2]} = $row[1];


foreach my $key (@ordre){
print "$key $x{$key}";