... my %count; $count{$_}++ for @dates; print "$count{$_} times $_\n" for sort {$count{$b} <=> $count{$a}} keys %count;