in reply to Matching two files real time

My first thought would be just to take md5sums of the files and see if they match. That is a fast operation, and won't tax the system. But it assumes the lines will be in the same position, maybe you can sort them first, before doing the md5sum?

If they don't match, open them and take a diff. See Seeking guidance on how to approach a task and Algorithm::Diff and here is a simple method using the hash count method described above.

#!/usr/bin/perl use strict; use warnings; open (FILE1, '<', 'file1.txt') or die "Unable to open file1.txt for re +ading : $!"; open (FILE2, '<', 'file2.txt') or die "Unable to open file2.txt for re +ading : $!"; my %lines; while ( <FILE1> ) { chomp; $lines{$_}++ } while ( <FILE2> ) { chomp; $lines{$_}++ } open (FILE3, '>', 'file3.txt') or die "Unable to open file3.txt for wr +iting : $!"; for ( keys %lines ) { next if $lines{$_} > 1; print FILE3 "$_\n"; }

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh