Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 0.22 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. use warnings;
  2. use strict;
  3.  
  4. my %count;
  5. $count{$_}++ for split //,$ARGV[0];
  6.  
  7. print "$_->{char}: $_->{count}\n" for
  8.     sort { $b->{count} <=> $a->{count} }
  9.     map  { { char => $_, count => $count{$_} } } (keys %count);