As some sample code I have:
I get the following printed out for the differences between $t1 and $t2#!/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);
Here is the computed difference between $t1 and $t3$VAR1 = [ [ '+', 19, 'e' ] ]; $VAR2 = [ [ '+', 45, '`' ] ];
How can I merge the two differences into one that can be applied to the original while verifying that the changes aren't conflicting. </CODE>$VAR1 = [ [ '-', 33, 's' ], [ '-', 34, 'e' ], [ '-', 35, 'c' ], [ '-', 36, 'o' ], [ '+', 33, 2 ] ]; $VAR2 = [ [ '+', 41, '`' ] ];
In reply to Question about Algorithm::Diff by vroom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |