in reply to How to sort?

What is the best type of perl structure to store this data in?

A hash, using each name as a key

1. read line, split on the space, then put in hash with name as the key pointing to the number as the value
2. sort on array returned by keys(%namehash) lexicographically
3. using the sorted list of keys, reconstruct the original data, only sorted

Replies are listed 'Best First'.
Re^2: How to sort?
by ysth (Canon) on Oct 14, 2007 at 19:52 UTC
    That assumes names are unique.