my @popular = (sort { $histogram{$b} <=> $histogram{$a} } @unique)[0..2]; print "@popular\n"; __END__ tomato watermelon oranges