in reply to Sort command equivalent in perl

Why do you think that perl's sort uses temporary files? If you need this type of sort, you will have to break the source data into parts, sort each part, and then merge them manually.

--MidLifeXis

Replies are listed 'Best First'.
Re^2: Sort command equivalent in perl
by BrowserUk (Patriarch) on Dec 15, 2011 at 16:56 UTC

    Or use Sort::External


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

Re^2: Sort command equivalent in perl
by Anonymous Monk on Dec 15, 2011 at 17:33 UTC
    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.

      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