#!/usr/bin/perl

# Coded by Trizen
# Prints words from $file2 which not exists on $file1;
# on 26 November 2011
# http://trizen.googlecode.com

my $file1 = shift @ARGV // '/tmp/1.txt';
my $file2 = shift @ARGV // '/tmp/2.txt';

sub usage {
    print "Usage:
    $0 [comparation_file] [file]\n
Description:
    Prints sorted lines from [file] which non exists in [comparation_file]\n";
    exit;
}

usage unless open my $fh1, '<', $file1;

my %hash1;
@hash1{<$fh1>} = ();
close $fh1;

usage unless open my $fh2, '<', $file2;

my %hash2;
@hash2{<$fh2>} = ();
close $fh2;

print sort(grep((!exists($hash1{$_})), keys %hash2));

