This is a FAQ. See perlfaq4 on How do I sort an array by (anything)?
In reply to Re: Sorting Complex Data Structure by Corion in thread Sorting Complex Data Structure by Anonymous Monk