Hi, All,

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


In reply to Need to sort large table of data... by fiddler42

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.