Although from your question it is a bit unclear what you are looking for, perhaps the following code segment will help.
#/usr/bin/perl -w use strict; foreach (sort split /\s+/,<DATA>) { /^\d/ ? print "FH1: $_\n" : print "FH2: $_\n"; } __DATA__ 953-FMT-FMT 954-FMT-FMT BLOGO93-FMT-FMT 955-FMT-FMT BOXSTART2- +FMT-FMT BOXEND2-FMT-FMT 956-FMT-FMT 413-FMT-FMT DATE1-FMT-FMT + 414-FMT-FMT 415-FMT-FMT 416-FMT-FMT BLOGO107-FMT-FMT 417-F +MT-FMT 419-FMT-FMT 418-FMT-FMT BLOGO63-FMT-FMT 393-FMT-FMT +394-FMT-FMT BLOGO75-FMT-FMT 420-FMT-FMT 421-FMT-FMT 395-FMT-F +MT
Which outputs...
FH1: 393-FMT-FMT FH1: 394-FMT-FMT FH1: 395-FMT-FMT FH1: 413-FMT-FMT FH1: 414-FMT-FMT FH1: 415-FMT-FMT FH1: 416-FMT-FMT FH1: 417-FMT-FMT FH1: 418-FMT-FMT FH1: 419-FMT-FMT FH1: 420-FMT-FMT FH1: 421-FMT-FMT FH1: 953-FMT-FMT FH1: 954-FMT-FMT FH1: 955-FMT-FMT FH1: 956-FMT-FMT FH2: BLOGO107-FMT-FMT FH2: BLOGO63-FMT-FMT FH2: BLOGO75-FMT-FMT FH2: BLOGO93-FMT-FMT FH2: BOXEND2-FMT-FMT FH2: BOXSTART2-FMT-FMT FH2: DATE1-FMT-FMT

Cheers,
Shendal

In reply to Re: sort on numbers embedded in text by Shendal
in thread sort on numbers embedded in text by d4vis

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.