NAME

String::Charcount - count the occurence of characters within a string.

SYNOPSIS

use String::Charcount q/:all/;

$string = 'The lazy brown fox jumped over the cat sitting on the fence.';

$count = count(\$string);
print 'e exists ', $$count{e}, ' times',"\n";

$percentage = percentage(\$string, $count);
print 'e percentage - ', $$percentage{e}, '%',"\n";

DESCRIPTION

String::Charcount counts the occurence of characters within a string and calculates percentage of occurence.

FUNCTIONS

count

Counts the occurence of all characters within a string.

$count = count(\$string);
print 'e exists ', $$count{e}, ' times',"\n";

Returns an hash ref with characters as keys and occurences as values.

percentage

Calculates percentage of occurence of all characters within a string.

$percentage = percentage(\$string, $count);
print 'e percentage - ', $$percentage{e}, '%',"\n";

Returns an hash ref with characters as keys and percentages of occurence as values.

EXPORT

count(), percentage() upon request.

TAGS

:all - *()

SEE ALSO

perl(1)

LICENSE

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Steven Schubiger