##
sub count_unique {
# extract unique elements of array and count occurrences
my @array = @_;
map { $count{$_}++ } @array;
map { "$_ = ${count{$_}}\n"} sort keys(%count);
return %count;
}
####
sub hashValueDescendingNum {
# sort hash by key length in descending order
length($a) <=> length($b)
}
####
this is a test => 2
is a test => 2
a test => 1