in reply to Re^5: sorting hash by value when value is an array ref
in thread sorting hash by value when value is an array ref

I'm noticing that template toolkit may do some default alphabetical sorting on hashes. This could explain your problem too.
  • Comment on Re^6: sorting hash by value when value is an array ref