I would try and use the system's sort(1) first as it's already optimized for this kind of stuff. 500M 32-bit integers would barely fit your memory if you put them in a straight C-style array with none of Perl's overhead, so it's probably a good idea to do a disk-based mergesort. Split the file into half a dozen or so parts, run sort on them individually and then use sort once more with -m to merge the results.
If you really need to do it in Perl, you could have a look at File::Sort but I have no idea whether it works well.
In reply to Re: "Out of memory" problem
by mbethke
in thread "Out of memory" problem
by abdullah.yildiz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |