1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
use Data::Dumper;
use List::Compare;
open(A, "a.txt") or die("pb lecture fichier1 : $!\n");
my @a = <A>;
chomp(@a);
close(A);
open(B, "b.txt") or die("pb lecture fichier2 : $!\n");
my @b = <B>;
chomp(@b);
close(B);
my $lc = List::Compare->new('-u', \@a, \@b);
my @common = $lc->get_intersection();
my @a_only = $lc->get_Lonly();
my @b_only = $lc->get_Ronly();
print "common\n";
print Dumper @common;
print "a only\n";
print Dumper @a_only;
print "b only\n";
print Dumper @b_only; |
Partager