My answer is, essentially, "what
ysth said".
The purpose of a hash is to provide fast access to a specific key, rather to store information in a sequential order.
You can always store the order an item was entered, and scan for it later. That is:
$in{$key}{rank} = $nthElement++;
Followed by
foreach $key (sort(keys %in)) {
print MAIL "\t", $key, " = \t", $in{$key}, "\n"
if $in{$key}{rank} == 0;
}