我直接给俩个文件,程序没有错误

你的$result 和 $new_result是什么?

use strict;
use warnings;

my $file1 = 'med_report.pl';
my $file2 = 'med_report.pl.back';

my $size1 = (stat $file1)[7];
my $size2 = (stat $file2)[7];

print "size1: $size1\t\tsize2: $size2\n";

if ($size1 == $size2) {
        print "same\n";
}
else {
        print "different\n";
}

ubuntu:~/programming/perl_prog$ ./cmp_file_size.pl  med_report.pl med_report.pl.back
size1: 2706        size2: 2706
same