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!
|