This is all in your datastructure. I would envision that you would convert the six lines above to something that would look similar to:
$VAR1 = { clock => 'blah/1', pin => 'blah/2', net => 'blah/3', clock_skew => '0.100', longest_delay => '1.000', shortest_delay => '1.100', };

If you do that, and have an array of these hashrefs, the sorting is very simple.

my @values = generate_data_from_some_datasource($data_source); # @values is now an array of hashrefs, each looking like the one above my @sorted_values = sort { $a->{clock} cmp $b->{clock} } @values;

The right data structure produces the easiest code. Now, instead of 'clock', you could, if a fellow was motivated, have an option that could be passed in. The trick is to make sure you're doing the right sort. cmp is alphanumeric sorting. <=> is numeric sorting. (A fellow, if interested, might look at creating objects that use overloaded sorting comparators, but that's probably overkill here.)

------
We are the carpenters and bricklayers of the Information Age.

Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.


In reply to Re: Sorting question... by dragonchild
in thread Sorting question... by Anonymous Monk

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.