in reply to What is the most memory efficient way to (sort) and print a hash?

Use each to print the hash:
while (my ($k, $v) = each %hash) { print "$k\t$v\n"; }

Then pipe to shell's sort -k2n.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: What is the most memory efficient way to (sort) and print a hash?
by a_salway (Initiate) on May 29, 2014 at 17:33 UTC

    Many thanks choroba. That prints the hash with no further memory usage which helps a lot. If you, or others, can suggest a better way to get sorted output then that would be a bonus.

      That prints the hash ... a ... way to get sorted output ... would be a bonus.

      So, what happens if you then actually (system) sort the output per choroba's original suggestion?

      Define 'better' in relation to the suggested answer. There are trade-offs whether you use this solution or another, e.g., using a database as suggested elsewhere in this thread.