use Data::Compare; use Data::Dumper; my $i = 0; my $y = 0; my $flag; my $x = 1; my @aoh; my @dupAoh; print "Tell me dude/dudette where are the log files: " , " \n"; $Location1 = ; chomp $Location1; #print "And where would you like to put the processed results: " , "\n"; #$Location2 = ; #chomp $Location2; $UserInputDir = $Location1; opendir DH, $UserInputDir or die "Cannot open $UserInputDir: $!"; @files = readdir DH; closedir DH; foreach $file (@files) { next if $file=~/^\./; print "creating hash for $file....\n"; %filehash1 = filetohash($Location1.'\\'.$file); push @aoh, \%filehash1; #print Dumper(\\%filehash1); $x++; } print scalar(@aoh)."\n"; @dupAoh = @aoh; #print Dumper(\@dupAoh); foreach $val (@aoh) { #print "$val and $val++"; %hashValue1 = pop(@dupAoh); for ($i = 0; $i < scalar(@dupAoh); ++$i){ %hashValue2 = @aoh[i]; #print Dumper(\\%hashValue1); #print Dumper(\\%hashValue2); Compare(\%hashValue1, \%hashValue2) ? "identical \n" : "not identical.\n"; #compHash(\%hashValue1, \%hashValue2); } } sub compHash{ my %filehash1 = shift; my %filehash2 = shift; for $key (keys %filehash1) { if($filehash2{$key} == 1){$flag = 1;}else{$flag = 0; last;} print "Flag value is $flag \n"; } ($flag == 1) ? print "Yooohoo exactly same \n" : print "Not Same Alas!!!\n"; } sub filetohash { my $counter; my $file = shift; my %filehash; open(FILE, "< $file") || die $!; while () { chomp $_; s/^ *//; s/ *$//; $filehash{$_} = 1; $counter++; } print "counted $counter lines for file $dir\n"; return \%filehash; }