Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Write large array to file, very slow

by QM (Parson)
on Aug 20, 2018 at 14:51 UTC ( [id://1220728]=note: print w/replies, xml ) Need Help??


in reply to Write large array to file, very slow

You should also be able to do a merge sort, holding only the most recently read line of each file in memory.

A quick search found File::MergeSort, which seems what you want. It can sort lines based on a key you specify:

Merge keys are extracted from the input lines using a user defined subroutine. Comparisons on the keys are done lexicographically.

While it sorts these keys lexicographically, there is room to munge the keyspace to do as you need. If you want your own sort routine, you can roll your own easily enough.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1220728]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (7)
As of 2024-03-28 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found