BoulderBuff64 has asked for the wisdom of the Perl Monks concerning the following question:
I need some advice on a classic sorting problem. Below is a little example of what my data looks like.
Data.txt 1.000 64.103 2840.0 1.000 42.735 2840.0 1.000 32.051 2840.0 1.050 64.103 3280.0 1.050 42.735 3280.0 1.050 32.051 3280.0 1.100 64.103 3720.0 1.100 42.735 3720.0 1.100 32.051 3720.0
I'd like my data to be first sorted by the second column then by the first column. It should look like the below example.
1.000 64.103 2840.0 1.050 64.103 3280.0 1.100 64.103 3720.0 1.000 42.735 2840.0 1.050 42.735 3280.0 1.100 42.735 3720.0 1.050 32.051 3280.0 1.000 32.051 2840.0 1.100 32.051 3720.0
I started using nested foreach loops but it started getting a little hairy, so I figured I'd ask the wise Monks. Thank you in advance for your time!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Classic Sort Algorithm
by AnomalousMonk (Archbishop) on Jun 20, 2011 at 22:45 UTC | |
by BoulderBuff64 (Novice) on Jun 20, 2011 at 23:05 UTC | |
by 7stud (Deacon) on Jun 21, 2011 at 00:12 UTC | |
|
Re: Classic Sort Algorithm
by Perlbotics (Archbishop) on Jun 20, 2011 at 22:46 UTC | |
| |
|
Re: Classic Sort Algorithm
by aquarium (Curate) on Jun 21, 2011 at 04:36 UTC | |
|
Re: Classic Sort Algorithm
by salva (Canon) on Jun 21, 2011 at 08:24 UTC | |
|
Re: Classic Sort Algorithm
by Cristoforo (Curate) on Jun 21, 2011 at 00:33 UTC |