frequency counter plugin

master
unlisted 2012-05-06 11:13:52 -04:00
parent 586dd1c7fb
commit d7d68f3d1a
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
package DDG::Goodie::Frequency;
# ABSTRACT: Displays frequency of each character
use DDG::Goodie;
triggers start => 'frequency';
handle remainder => sub {
if ($_)
{
my %freq;
my $lower = lc;
my @chars = split //,$lower;
foreach my $char (@chars)
{
++$freq{$char} unless $_ eq ' ';
};
return "FREQUENCY: " . keys %freq if $_;
};
return;
};
zci is_cached => 1;
1;