in reply to count sort & output
2. You can use sort.
@descending_values = sort {$hash{$b} <=> $hash{$a} } keys %hash; [download]
3. Show us what you have already, and we can help you from there.
-enlil