Created
January 5, 2015 06:52
-
-
Save moznion/0fc7e7cf503314d20acc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
my ($old_file, $new_file) = @ARGV; | |
if (!defined $old_file || !defined $new_file) { | |
die "You must give two file names via command line argument"; | |
} | |
open my $old_fh, '<', $old_file or die "Cannot open file ($old_file): $!"; | |
my @old_file_lines = sort { $a cmp $b } split /\r?\n/, do { local $/; <$old_fh> }; | |
open my $new_fh, '<', $new_file or die "Cannot open file ($new_file): $!"; | |
my @new_file_lines = sort { $a cmp $b } split /\r?\n/, do { local $/; <$new_fh> }; | |
if (join('', @old_file_lines) ne join('', @new_file_lines)) { | |
print "Different!\n"; | |
} | |
__END__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment