use strict; use Algorithm::Diff qw(traverse_sequences); my @quote1 = split(' ', < sub { $match++ } } ); my $smaller = @quote1 < @quote2 ? @quote1 : @quote2; my $percent_match = int(($match / $smaller) * 100); print "$match words matched ($percent_match%)\n"; __END__ 18 words matched (90%)