Here is part of it, I think that this is enough to be relevent
I don't mean to be rude, but Paul clearly asked for something that is
short (about 20 lines is reasonably considered short), and most
importantly, cut-and-pasteable.
Here's what something like that might look like:
#!/usr/bin/perl
use warnings;
use strict;
my @unsorted = ( { id => 03, name => "hi", count=> 200 },
{ id => 01, name => "hi", count=> 100 },
{ id => 02, name => "hi", count=> 150 } );
my @sorted = sort { $a->{count} <=> $b->{count} } @unsorted;
print "id: [$_->{id}] name: [$_->{name}], count: [$_->{count}]\n" for @sorted;
__END__
This gives me:
id: [1] name: [hi], count: [100]
id: [2] name: [hi], count: [150]
id: [3] name: [hi], count: [200]
Observe the following characteristics, and how they differ from what
you offered:
1) My code is very short. It's easy to read. 20 lines is about the
maximum we recommend that people post, because longer than that,
code gets much harder to read.
Your code is about twice that long, and includes a lot of
extraneous information that a reader has to read and understand and
then decide if it's meaningful or not.
2) My code only contains the very bare minimum required to display the
problem (or in this case, lack of problem

.
Your code contains about 30 lines of code that doesn't actually
involve your problem; instead, it's a loop that iterates over data
we don't know anything about to create a structure that we can only
guess at.
Since you're not asking us for help in generating your hashrefs,
it's not relevant to your problem how your hashrefs are created.
For the purposes of sorting them, all we need is a few examples of
what they look like, and what your attempt to sort them looks like.
3) My code is cut-and-pasteable into a file. Including the __END__
token will allow anybody who accidentally includes a few extra
lines to run it anyway.
If your code cannot be cut and pasted, you lose the help a LOT of
very talented people who don't want to spend the time reading
through your code and trying to understand it. Code that runs is
very easy to look at and understand. Code that doesn't requires
very hard work to understand, and most of us are volunteers and not
inclined to doing that work.
4) I used strict (which you did, and good for you for doing so) AND
warnings. Posting code which uses both probably doubles if not
triples the number of people willing to help.
#!/usr/bin/perl
use strict;
use ........... code removed ............
This doesn't compile. That's why our posting guidelines (which are
posted on this newsgroup at least twice a week) specify to only post
code which is cut and pasted; that removes the possibility of typos
causing problems.
my
($_RH_users_in_queue,$_RA_user_report_queue,$array_item,$keys,$start_date,
$end_date);
my ($_total_tickets,%_total_tickets, $i, $j, %_RH_users_in_queue,
$_user_resolved, $teamreport, @teamreport, $_norm_tickets);
We don't need all this information to solve your problem.
............. code removed ..............
foreach $i ('queue01','queue02','queue03' )
{
$_total_tickets = $query->total_tickets_queue($dbh,
$query->param(-name=>"$i"), $start_date, $end_date);
if ( ( $query->param(-name=>"$i") == 0 )
|| $_total_tickets == 0 ) { last }
$_RH_users_in_queue =
$query->users_in_queue($dbh,$query->param(-name=>"$i"));
$_RA_user_report_queue = $query->user_report_queue_resolved($dbh,
$query->param(-name=>"$i"), $_RH_users_in_queue, $start_date,
$end_date);
foreach $j (keys %$_RH_users_in_queue)
{
my %matrix;
$matrix{id} = $j;
$matrix{name} = $_RH_users_in_queue->{$j};
$matrix{queue} = $query->param(-name=>"$i");
$matrix{queue_total} = $_total_tickets;
$matrix{tickets} =
$query->user_tickets_resolved($dbh,$matrix{queue},$matrix{id},$start_date,$end_date);
$matrix{norm_tickets} = ( $matrix{tickets} / $_total_tickets ) *
100;
push(@teamreport ,\%matrix);
}
}
All this code does is, it seems, build up a list of hashrefs.
Instead, you could just show us an example list, maybe three or four
items long. We just need enough information to know what you're
sorting, and what it looks like.
#my @teamreport_sorted = sort { $a{norm_tickets} <=> $b{norm_tickets}
} @teamreport;
This is a little confusing. I'd leave it out next time.
my @teamreport_sorted = sort { ($a->{norm_tickets}) <=>
($b->{norm_tickets}) } @teamreport;
This is the meat of the sort, and as far as I can tell, it's correct.
The parenthesis are unnecessary, though, and I'd remove them for
clarity:
my @teamreport_sorted = sort { $a->{norm_tickets} said:
@teamreport_sorted when printed is unsorted.
Please show us exactly what it looks like before, and exactly what it
looks like after. And no, this is NOT a request for every single one
of your 2,000 hashrefs; just give us a few, and show how you print
them out before, and how you print them out after; reduce the problem
to its barest possible essentials.
This is not, repeat NOT intended as a flame or rip on your skills.
I'm trying to help you help yourself. If you give us an example that
follows all 4 of the criteria I delineated above, you'll have a very
fast answer that is very high quality. And, better yet, in the
process of stripping things down into the smallest possible example,
you may even figure out the problem on your own, which is even better.
-=Eric