Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Sorting By Column

by dasgar (Curate)
on Jul 10, 2014 at 18:58 UTC ( #1093104=note: print w/replies, xml ) Need Help??


in reply to Sorting By Column

I'm not sure that I totally understand what you're trying to do. It kind of sounds like you're merging multiple lists (from different files) and then wanting to do multiple column sorting of the data. Assuming that's correct, here's how I personally would approach the problem.

First, read in each file and put the data into a multidimensional array (AoA). After that, you could use something like Data::Table sort by the second column (numerically ascending) and then by the first column (numerically ascending). Once you have it sorted, just print it out to the new file.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1093104]
help
Chatterbox?
[Eily]: someday FF will start posting back messages where you tell to ignore the previous message
[Eily]: and Hilarity Ensues
Eily says, while failing to write a link properly
[Your Mother]: Goodbye Fancy Feast! Hello Friskies!!!
[LanX]: CB sidebar auto-expansion problem
[Eily]: "tail: warning: following standard input indefinitely is ineffective". I can't help but feel that tail is judging me...
[Your Mother]: Someone had to say it. Better it came from tail.
[LanX]: Cat Mama!
[Your Mother]: Das right.

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (8)
As of 2017-03-27 16:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.