String::Compare::Length - String Length Comparisons


String-Compare-Length documentation  | view source Contained in the String-Compare-Length distribution.

Index


NAME

Top

String::Compare::Length - String Length Comparisons

SYNOPSIS

Top

  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

Top

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

Top

String::Compare

AUTHOR

Top

Mike Accardo

COPYRIGHT AND LICENSE

Top


String-Compare-Length documentation  | view source Contained in the String-Compare-Length distribution.