in reply to Re: Sort command equivalent in perl
in thread Sort command equivalent in perl

I would like to sort very large size file around 5-10GB size. However using Perl Sort command, script get executed for very long time & get aborted due to out of memory issue. Hence, my assumption is it should store intermediate temporary files at the same directory. So, storing these temporary files some other location may resolve this issue. So, just checking if we can specify temporary directory location in sort command like unix.

Replies are listed 'Best First'.
Re^3: Sort command equivalent in perl
by MidLifeXis (Monsignor) on Dec 15, 2011 at 18:02 UTC

    Perl's default sort routine is an in memory sort routine. The OS sort program is a file-based sort routine that can handle larger data sets. If you want Perl to do the same as the unix sort program, you will need to implement it your self (my comment above), or find someone else's implementation and use it (BrowserUK's suggestion above). There are no temp files used by the out-of-the-box sort routine in Perl.

    --MidLifeXis