@count_s = sort { $reportn{$a} <=> $reportn{$b}; } @count_s; foreach (@count_s[0..4]) { print "$_ ====> $reportn{$_}\n"; }