You've been pointed to documentation which you appear not to have read.
You been asked for information which you haven't supplied.
Without doing these things, I don't know how you think we can help you.
I provided a link to sort.
Here you'll find many examples including this basic one for sorting numerical data in descending order:
# sort numerically descending
@articles = sort {$b <=> $a} @files;
Corion provided a link to DBI (in Re^3: Ranking MySQL Entries?).
If you're unfamiliar with that module, look the "Simple Examples" section in that documentation.
Once you have your data, in whatever data structure you choose, you'll probably need a more complicated sort than the basic example shown above. Perhaps something like this:
#!/usr/bin/env perl -l
use strict;
use warnings;
use Data::Dump;
my @unordered = (
{ id => 12, rownum => 1, rank => 27 },
{ id => 31, rownum => 3, rank => 72 },
{ id => 45, rownum => 5, rank => 54 },
);
my @ordered = sort { $b->{rank} <=> $a->{rank} } @unordered;
print 'Unordered:';
dd \@unordered;
print 'Ordered:';
dd \@ordered;
Output:
Unordered:
[
{ id => 12, rank => 27, rownum => 1 },
{ id => 31, rank => 72, rownum => 3 },
{ id => 45, rank => 54, rownum => 5 },
]
Ordered:
[
{ id => 31, rank => 72, rownum => 3 },
{ id => 45, rank => 54, rownum => 5 },
{ id => 12, rank => 27, rownum => 1 },
]
You need to follow the guidelines in "How do I post a question effectively?".
Note what it says about posting code, data, output and warning/error messages.
Pay particular attention to what it says about providing "a minimal script that reproduces your problem" in your post.
Unless you do this, we can not help you further!
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.