in reply to sorting a hash by its values, date

Well, first of all you can't really sort a hash. A hash is always unsorted. Also, you're sorting the hash keys and values together, which is probably not what you want. If you want to process the hash values in a sorted order, do this:
foreach $value (sort by_date values %H) { # ... }

If you need the keys, sorted by their corresponding values:

foreach $key (sort { by_date($H{$a},$H{$b}) } keys %H) { }
If it still doesn't work, try showing some of the input and expected output of your code.

By the way, code can be much easier formatted using <code> tags.