A less verbose way to do something similar:
my $data = do { local $/; <DATA> }; my $patt = join '|' => map quotemeta, 'a' .. 'z'; my %freq; $freq{$1}++ while $data =~ /($patt)/go; # etc...
Of course, counting occurrences of mere letters should normally be done using tr. ;-)
Also, mkent may want to save intermediate (sorted) results to avoid duplicating work.
In reply to Re: Re: count sort & output
by Anonymous Monk
in thread count sort & output
by mkent
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |