in reply to sorting and comparing hashes

Note that your sort code will not do anything!
You may not have understood that the perliaq (Infrequently Asked Questions about Perl) is humour.

For a serious answer, have a look to the Perl FAQ.

Olivier Mengué