When Perl is doing this comparison is it doing it line by line (like an
actual DIFF) or is it putting the lines into an "array" and the checking
that array against the second file?

use strict;
use warnings;

open VASH, "vash.txt" or die "Can't open the file: $!\n";
open MONH, "monh.txt" or die "Can't open the file: $!\n";
open MANI, "mani.txt" or die "Can't open the file: $!\n";

my %dict;

$dict{$_} = 1 while <VASH>;

# This will insert in the text files the lines that are in
# the Vashon but not in the Monhegan
while (<MONH>) {
    open VASH2MONH, ">>VASH2MONH.TXT";
    print VASH2MONH if !$dict{$_};
    close VASH2MONH;
}
print "Mohegan comparison is done.\n";

# This will insert in the text files the lines that are in
# the Vashon but not in the Manitou
while (<MANI>) {
    open VASH2MANI, ">>VASH2MANI.TXT";
    print VASH2MANI if !$dict{$_};
    close VASH2MANI;
}
print "Manitou comparison is done.\n";

close MANI;
close MONH;
close VASH;

print "Comparison is completed.\n";

It works. I am just wondering in what fashion it IS working.

Robert



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to