The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

String::DiffLine - find the character, line, and line position of the first difference in two strings

SYNOPSIS

  use String::DiffLine qw(diffline);
  ($char,$line,$lpos)=diffline("abc","abx");

DESCRIPTION

diffline($str1,$str2)

Returns a three-item list identifying the location of the first difference between the two strings: the character position (indexed from 0), the line number (indexed from 1), and the character position in the current line of the first difference (indexed from 0). "$/" in perlvar is used as the line separator.

If the strings are identical, the returned list's first element is undef, its second element is the number of lines in the string (i.e., the number of line separators plus one), and the last element is the number of characters following the last line separator.

AUTHOR

Andrew Allen <andrew_d_allen (at) hotmail.com>

SEE ALSO

perl(1).