The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Text::CountString - the frequency count of strings

SYNOPSIS

    use Text::CountString;

    warn count_string("There is more than one way to do it", "o"); # 4

DESCRIPTION

Text::CountString is the module for counting the frequency of words.

METHOD

below methods are exported.

count_string($target_text, $string)

    warn count_string("a b c d a b c", "a"); # 2

To get the frequency count of strings

Also you can get counts of bulk strings

    my $result = count_string(
        "There is more than one way to do it.",
        "o", "e", "h",
    );
    warn $result->{o}; # 4
    warn $result->{e}; # 4
    warn $result->{h}; # 2

CHANGE IMPLEMENTS

This module can switch implements for counting string.

By default, to count strings is invoked by the regexp implement. Generally, It's fast enough.

    use Text::CountString

However, if you can guess that there are many many matched strings, then the 'split implement' is faster than regexp implement. So the internal implement can be switched 'regexp' to 'split' like below.

    use Text::CountString qw/split/;

REPOSITORY

Text::CountString is hosted on github <http://github.com/bayashi/Text-CountString>

Welcome your patches and issues :D

AUTHOR

Dai Okabayashi <bayashi@cpan.org>

SEE ALSO

LICENSE

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.