Text::Difference - Compare two strings and find which tokens are actually different, with optional stopwords.
Version 0.02
Compare two strings to check what tokens (words) are actually different, if any.
use Text::Difference; my $diff = Text::Difference->new( a => 'big blue car', b => 'yellow car in small', stopwords => [ 'in' ], tokens => { colour => [ 'blue', 'yellow' ], size => [ 'big', 'small' ], } debug => 0, ); $diff->check; $diff->match; # true $diff->a_tokens_remaining; # a hashref $diff->a_tokens_matched; # a hashref
$diff->check
To install Text::Difference, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::Difference
CPAN shell
perl -MCPAN -e shell install Text::Difference
For more information on module installation, please visit the detailed CPAN module installation guide.