my @patterns = qw( a b c d e f g h i j k l m n o p q r s t u v w x y z + ); my %hash; my $data = do { local $/; <DATA> }; for (@patterns) { $hash{$_}++ for $data =~ /\Q$_\E/g; } my $counter = 0; for (sort {$hash{$b} <=> $hash{$a}} keys %hash) { print "$_ - $hash{$_}\n"; unless (++$counter % 10) { print "Press Enter"; <STDIN> } } __END__ Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in liberty and dedicated to the proposition that all men are created equal.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: count sort & output
by sauoq
in thread count sort & output
by mkent
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |