Help for this page

Select Code to Download


  1. or download this
    $ret = system("diff >/dev/null -r  $some_dir/$f $other_dir/$f");
    if(0 == $ret) { # files are the same
    } elsif(1 == $ret) { # files differ
    } else { # Error from diff
    }
    
  2. or download this
    open(my $fh, '-|', "diff -r  $some_dir/$f $other_dir/$f") or die "diff
    +: $!";
    my $diff = <$fh>;
    close $fh;
    if($diff) { # there were diffs
    }