in reply to How do I sort into an index?

use a hash where the key is your sort order and the value is what you would have put in your "value array".

Originally posted as a Categorized Answer.