Sunday, January 08, 2017

Find difference between two text files in Perl

#!/usr/bin/env perl
use strict;
use warnings;
use Text::Diff;

my $file1 = $ARGV[0];
my $file2 = $ARGV[1];

my $diffs = diff $file1,$file2;
my @strings = split("\n",$diffs);

foreach(@strings)
{
    print $_."\n";
}