#!c:\perl\bin\perl.exe use strict; use warnings; use DBI; use Text::Diff; use IO::File; my $diff; my $dbh; #Create the strings first $dbh = DBI->connect('dbi:mysql:dickens:localhost', 'admin', 'pass'); #my ($indexstring) = $dbh->selectrow_array('SELECT sentence FROM sequence'); #my ($additionaltext) = $dbh->selectrow_array('SELECT sentence FROM sequence1'); my @indexstring; my @additionaltext; my $result; my $sth = $dbh->prepare("SELECT sentence FROM sequence"); $sth->execute; while (my @result = $sth->fetchrow_array) { push @indexstring,$result[0]; } $sth = $dbh->prepare("SELECT sentence FROM sequence1"); $sth->execute; while (my @result = $sth->fetchrow_array) { push @additionaltext,$result[0]; } $dbh->disconnect(); ################################ #Compare strings or arrays ################################ #Use Text::Diff for arrays. #Need a regex to get the relevant data out my @difference = diff \@indexstring, \@additionaltext; foreach $diff(@difference) { my $unequal = split(/+/, $diff); print "$unequal\n"; }