OK - Here's a sample line of what I'm trying to sort: # <b><a href="http://a.website.I.need.to.use/CHARTS/formbrowsec.cgi?AP=CHOPS&FN=F3000022">CHOPS F3000022</a></b> 20000407 Brief problem desc goes here.      SMITH JOHN          ACCEPTED   NGSS70 I need to sort each of these lines by date(20000407 in this example), which if you split the above line by whitespace (split(/\s+/, $line), makes the date the 4th item (3) in the resultant array given by the split function.. I'm running into all sorts of problems with sort b/c of that whole ASCIIbetical thing, and the fact that I can't seem to get the $a and $b to point to the right items to sort by. Can anyone offer any examples of reading from a file, and sorting by a particular field, and then outputting that resultant sorted array? Thanks so much. When I can't understand the examples in the O'Reilly book I start to worry...

In reply to Sorting, arrays and other problems by TrinityInfinity

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.