NAME

String::Compare::Length - String Length Comparisons

SYNOPSIS

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";
}

DESCRIPTION

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.

FUNCTIONS

compare_array

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.

compare_arrays

Accepts two arrays. Determines the average string length in both arrays. Returns the difference between them.

compare_hoa

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.

SEE ALSO

String::Compare

AUTHOR

Mike Accardo

COPYRIGHT AND LICENSE

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.