diff --git a/lib/DDG/Goodie/Frequency.pm b/lib/DDG/Goodie/Frequency.pm index 5dd92c9c1..8991fe04b 100644 --- a/lib/DDG/Goodie/Frequency.pm +++ b/lib/DDG/Goodie/Frequency.pm @@ -9,16 +9,21 @@ handle remainder => sub { if ($_) { my %freq; - - my $lower = lc; - my @chars = split //,$lower; - - foreach my $char (@chars) + my @chars = split //, "\L$_"; + + foreach (@chars) { - ++$freq{$char} unless $_ eq ' '; + ++$freq{$_} if $_ =~ /[a-z]/i; }; - return "FREQUENCY: " . keys %freq if $_; + my @out; + foreach my $key (keys %freq) + { + push @out, (join ":",$key,$freq{$key}); + print "$freq{$key}\n"; + }; + + return "FREQUENCY: " . join ' ',sort(@out) if @out; }; return;