we get module1 and module 2 from the two files

which i have uploaded.

But actually the problem is i was not listing differences correctly

i have uploade the output image also

but actually that number of differences are not there.

only 6 to 8 diifferences are there so how to handle this problem.

we are using dort as the split parameter so 5.0000 is taken as 5

and 00000 and comparing as two paramters.

so i tried using other but output is disturbed.

so please try to solve.

use strict;
use warnings;
#use Getopt::Long;  
  #my $filename1;
  #my $filename2;
  #my $modul;
   #my @args    = @ARGV;
  #print "Getting the options";
 # my $ok = &GetOptions("args"     => sub { &PrintArgs(\@args) },
#		       "h|help|?" => sub { &Help },
#		       "filename1=s"      => \$filename1,
#		       "filename2=s"      => \$filename2,
#		       "modul=s" => \$modul);
#		  print "\n\n";
#		   print " --------------------------------File1: $filename1 #File2:$filename2	-------------------------------------\n\n\n\n";


my $modul='X_MMCM_ADV';
my $filename1 = 'ise_routed.v';
my $filename2 = 'rodin_routed.v';



my $string1 = readfile( $filename1); 

my $string2 = readfile( $filename2); 


sub readfile {
  
    my ($file) = @_;
    local $/;
    open my $fh,'<',"$file" or die "open of $file failed: $!\n";
    <$fh>;
    };




 
$string1 =~ /$modul #\(([^;]*)\);/s;
my $modcode_from_1 = $1;
#print "$modcode_from_1";
open (MYFILE, '>module1.txt');
print MYFILE "$modcode_from_1\n";
close (MYFILE); 
undef $string1; 
$modcode_from_1 =~ s/[[:cntrl:]]//gm; 


$string2 =~ /$modul #\(([^;]*)\);/s;
my $modcode_from_2 = $1;
#print "$modcode_from_2";
open (MYFILE1, '>module2.txt');
print MYFILE1 "$modcode_from_2\n";
close (MYFILE1); 
undef $string2; 
$modcode_from_2 =~ s/[[:cntrl:]]//gm; 



my @codes1 = split /\./, $modcode_from_1;

my @codes2 = split /\./, $modcode_from_2;


print "\t\t****************THE DIFFERENCES IN THE FILES ARE AS FOLLOWS****************\n\n\n";

printf "\t\t\t%-45s %s\n\n\n", $filename1, $filename2;

my $i = 0;
foreach (@codes1) {
    unless ($codes1[$i] eq $codes2[$i]) {
        
        printf "\t%-45s is not the same as %s\n\n", $codes1[$i], $codes2[$i];


    
    }
    
    
    
    $i++;
}

use comma as the split delimeter it works fine

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.