You havethe answers that you need. But for future reference for posting questions here, here are a few hints.

Keep your data short. If you can demonstrate what you need with 5 lines of data then any more is obscuring your point and people will stop reading your question.

Generally we like to see some code to see that you have had a try at solving the problem.

If you absolutly must include a huge amount of data then put it in readmore tags (see Writeup Formatting Tips).

Although your code and data generally show a problem, it is always good to describe your problem in words so that we understand where you are coming from. In this case you could have posted something like:

I have a problem sorting some data that is mixed numbers and letters. At the moment I am using sort but the result is like this:

K-2-D-19A K-2-D-1D K-2-D-20A K-2-D-20B K-2-D-2I K-2-D-2J

and I would like it to be like:

K-2-D-1D K-2-D-19A K-2-D-2I K-2-D-2J K-2-D-20A K-2-D-20B

How do I do that?


DWIM is Perl's answer to Gödel

In reply to Re: Sorting question by GrandFather
in thread Sorting question by perl_seeker

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.