Like this? Your "Desired Output" is unclear.

#!/usr/bin/perl # http://perlmonks.org/?node_id=1186568 use strict; use warnings; while(<DATA>) { my %items = reverse /(SATID (\d\d).{27})/g; print "@items{ sort keys %items }\n"; } __DATA__ SATID 02 VAL1 32 VAL2 275 SIGNAL 43 SATID 24 VAL1 10 VAL2 098 SIGNAL 1 +2 SATID 41 VAL1 87 VAL2 180 SIGNAL 15 SATID 24 VAL1 41 VAL2 103 SIGNAL 56 SATID 02 VAL1 41 VAL2 154 SIGNAL 3 +1 SATID 41 VAL1 93 VAL2 124 SIGNAL 21 SATID 41 VAL1 23 VAL2 132 SIGNAL 23 SATID 24 VAL1 32 VAL2 034 SIGNAL 3 +2 SATID 02 VAL1 23 VAL2 145 SIGNAL 31 SATID 41 VAL1 63 VAL2 305 SIGNAL 62 SATID 33 VAL1 31 VAL2 174 SIGNAL 4 +4 SATID 02 VAL1 45 VAL2 205 SIGNAL 34

In reply to Re: Sorting Data? by tybalt89
in thread Sorting Data? by coding1227

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.