We might be looking at it differently (me being the novice!), but doing this I organize it, however, the dates will change, so it seems to only group by the last number, not by the date as well. See how all 9's and all 10's, etc, will be grouped, regardless of the prior date. That is critical or the logs will be useless
foreach (@files) { my $file = $_; my @newfiles = map { $_->[0] } sort { $a->[1] <=> $b->[1] } map { [ $_, /.+?-(\d+)\..+$/ ] } @files; print $_,$/ for @newfiles; outputs for example: abcd1_abc_123456.abc1a_A.201307282200-2300-9.gz abcd1_abc_123456.abc1a_A.201307282300-2400-9.gz abcd1_abc_123456.abc1a_A.201307272100-2200-10.gz abcd1_abc_123456.abc1a_A.201307281900-2000-10.gz I need it to output like this: abcd1_abc_123456.abc1a_A.201307282200-2300-1.gz abcd1_abc_123456.abc1a_A.201307282200-2300-2.gz abcd1_abc_123456.abc1a_A.201307282200-2300-3.gz abcd1_abc_123456.abc1a_A.201307282200-2300-4.gz ..etc.. abcd1_abc_123456.abc1a_A.201307282200-2300-10.gz abcd1_abc_123456.abc1a_A.201307282200-2300-11.gz abcd1_abc_123456.abc1a_A.201307282200-2300-12.gz abcd1_abc_123456.abc1a_A.201307282300-2400-1.gz abcd1_abc_123456.abc1a_A.201307282300-2400-2.gz abcd1_abc_123456.abc1a_A.201307282300-2400-3.gz abcd1_abc_123456.abc1a_A.201307282300-2400-4.gz abcd1_abc_123456.abc1a_A.201307282300-2400-5.gz ..etc.. abcd1_abc_123456.abc1a_A.201307282300-2400-10.gz abcd1_abc_123456.abc1a_A.201307282300-2400-11.gz abcd1_abc_123456.abc1a_A.201307282300-2400-12.gz

In reply to Re^4: Custom Sort Array by omegaweaponZ
in thread Custom Sort Array by omegaweaponZ

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.