String::Compare::Length - String Length Comparisons
use String::Compare::Length; my $string = "Netscape"; my @strings = qw(Opera Safari Konqueror Mosaic); my $difference = compare_array($string,@strings); if ($difference == 0) { print "The string has a length equal to the average length of strings in the array"; } else { print "The difference in length is $difference"; }
This module was created when I needed to use string length to determine the likelihood of a string belonging to a group of strings. With this module, you can calculate the difference in length between a string and the average length of strings in an array. Not limiting itself to simple arrays, the module also accomodates hashes of arrays. You can also compare the average lengths of strings in two arrays.
Accepts a string and an array. Determines the string length and the average length of the strings in the array. Returns the difference between the two.
Accepts two arrays. Determines the average string length in both arrays. Returns the difference between them.
Accepts a string and a hash containing array references. Determines the string length and average length of the strings in each array. Returns a hash reference with the same keys as the original but whose values are now the difference between the lengths.
String::Compare
Mike Accardo
Copyright (C) 2009 by Mike Accardo
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install String::Compare::Length, copy and paste the appropriate command in to your terminal.
cpanm
cpanm String::Compare::Length
CPAN shell
perl -MCPAN -e shell install String::Compare::Length
For more information on module installation, please visit the detailed CPAN module installation guide.