http://qs321.pair.com?node_id=53932


in reply to Sorting data that don't fit in memory

Mastering Algorithms with Perl discusses your problem on page 150 (External Sorting) and recommends mergesort as the "easiest solution". Mergesort in Perl is described on page 134 and 135. If I recall correctly, there is also a discussion of your problem in Jon Bentley's Programming Pearls. A third source of guidance that is still less extensive than Knuth is Introduction to Algorithms by Cormen, Leiserson, and Rivest (my favourite, contains excellent pseudocode and very good discussions).

Christian Lemburg
Brainbench MVP for Perl
http://www.brainbench.com