#!/usr/bin/perl -w #use strict; sub slurp{ local *ARGV; @ARGV = @_; <> } my %where; $file1 = "c:\\gpTemp\\chris\\validation\\brookdeliv\.txt"; $file2 = "c:\\gpTemp\\chris\\validation\\LD\.txt"; $both = "c:\\gpTemp\\chris\\validation\\ld\\Acts_delivered\.txt"; $infile1 = "c:\\gpTemp\\chris\\validation\\ld\\Acts_Missing\.txt"; $infile2 = "c:\\gpTemp\\chris\\validation\\ld\\Acts_Extra\.txt"; open BOTH, "> $both" or die "Cannot open $new for writing: $!"; open INFILE1, "> $infile1" or die "Cannot open $new for writing: $!"; open INFILE2, "> $infile2" or die "Cannot open $new for writing: $!"; $where{$_} .= "1" for slurp($file1); $where{$_} .= "2" for slurp($file2); for (sort keys %where) { my $where = $where{$_}; if ($where =~ /12/) { print BOTH; } elsif ($where =~ /1/) { print INFILE1; } else { print INFILE2; } print ":\t$_"; }