$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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |