#!/usr/bin/perl use Algorithm::Diff qw(diff); use Data::Dumper; my $t1="This is the 1st lin\n This is the second line"; my $t2="This is the 1st line\n This is the second line`"; my $t3="This is the 1st lin\n This is the 2nd line`"; my @t1=split(//,$t1); my @t2=split(//,$t2); my @t3=split(//,$t3); @diff=diff(\@t1,\@t2); @diff2=diff(\@t1,\@t3); print Dumper(@diff); print "\n--------\n"; print Dumper(@diff2);