in reply to Save the resultant of " hash sorted by values "
The whole idea of a hash structure is that you can find any key, randomly, very fast ... but the trade-off that you always pay, is that the keys occur in no particular order, and that the perceived order of keys can change at any time. You can, however, "sort keys" and capture the result in another array... just be aware that you are gobbling up memory in doing so, and if the hash is in fact a tied-hash (i.e. not a memory data structure at all) your approach would basically be scroo'd. Seriously consider using an SQL table, even an SQLite (therefore, single file) database. "Memory" is sometimes highly over-rated.
|