fiddler42 has asked for the wisdom of the Perl Monks concerning the following question:
I have a gigantic array named @AllPatterns, and each entry in the array consists of exactly 5 numbers, formated like so:-
1 2 1 1 8
1 6 5 12 12
1 1 1 1 1
1 1 1 1 1
etc. In other words: a decimal number always followed by exactly one blank space. This is guaranteed.
I need to do a couple of important sorts, and I am not sure how to pull them off. The sorts need to go like this:-
1. Sort all data by the first, then second, then third, then fouth, then 5th column.
2. After the sort completes, collapse the array until it possesses nothing but unique combinations of numbers.
3. When collapsing the table to its unique entries, keep track of all the occurences that got collapsed.
Based on the simple example above, the end result would be:-
2 - 1 1 1 1 1
1 - 1 2 1 1 8
1 - 1 6 5 12 12
...where the first number is the number of collapsed entires.
I think I know how to do number #1, but I am not sure how to do #2 and #3. Any suggestions?
Thanks,
-fiddler42
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Need to sort large table of data...
by igelkott (Priest) on Feb 18, 2008 at 23:22 UTC | |
by fiddler42 (Beadle) on Feb 19, 2008 at 01:01 UTC | |
|
Re: Need to sort large table of data...
by Zen (Deacon) on Feb 18, 2008 at 23:02 UTC | |
|
Re: Need to sort large table of data...
by quester (Vicar) on Feb 19, 2008 at 05:39 UTC | |
by tilly (Archbishop) on Feb 19, 2008 at 07:46 UTC | |
|
Re: Need to sort large table of data...
by Anonymous Monk on Feb 19, 2008 at 03:24 UTC | |
|
Re: Need to sort large table of data...
by tilly (Archbishop) on Feb 19, 2008 at 07:35 UTC |