for my $x (sort { $a->{hits} <=> $b->{hits} } @array) { ... }