my %hash_without_duplicates = reverse %{ +{ reverse %hash_with_duplicates } };