foreach $key (sort { by_date($H{$a},$H{$b}) } keys %H) { }