1#!/usr/bin/perl 2 3# 4# Copyright (C) 2017 and later: Unicode, Inc. and others. 5# License & terms of use: http://www.unicode.org/copyright.html 6# 7 8use strict; 9 10my $file; 11my $secondfile; 12my %secondfilelist; 13my @same; 14my %list; 15my $samefile; 16 17foreach $secondfile (@ARGV) { 18 $secondfilelist{$secondfile} = ""; 19} 20 21foreach $file (sort keys(%secondfilelist)) { 22 if(exists $secondfilelist{$file}) { 23 delete $secondfilelist{$file}; 24 foreach $secondfile (sort(keys %secondfilelist)) { 25 #print "diffing: $file and $secondfile\n"; 26 if (!`diff $file $secondfile`) { 27 #print "$file and $secondfile are the same\n"; 28 push @same, $secondfile; 29 } 30 } 31# if ($#same > -1) { 32 print "Adding @same to $file\n"; 33 $list{$file} = [@same] ; 34 foreach $samefile (@same) { 35 delete $secondfilelist{$samefile}; 36 } 37 delete @same[0..$#same]; 38# } 39 } 40} 41 42 43my $i = 0; 44my $j = 0; 45 foreach $file (sort( keys %list)) { 46 #print "$file -> "; #@{list{$file}}\n"; 47 print "<$file> <$j>\n"; 48 foreach $i ( 0 .. $#{ $list{$file} } ) { 49 #print "$list{$file}[$i] "; 50 print "<$list{$file}[$i]> <$j>\n "; 51 } 52 $j++; 53 } 54 55