---
combine | 18 ++++++++++++++++--
1 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/combine b/combine
index a695935..c139cf7 100755
--- a/combine
+++ b/combine
@@ -95,6 +95,17 @@ sub hashify {
return \%seen;
}
+sub read_file_and_hashify {
+ my $file = shift;
+
+ my ($a_ref, $h_ref) = ([], {});
+ filemap $file, sub {
+ push @$a_ref, $_;
+ $h_ref->{$_} = 1;
+ };
+ return ($a_ref, $h_ref);
+}
+
sub compare_or {
my ($file1, $file2) = @_;
@@ -105,8 +116,11 @@ sub compare_or {
sub compare_xor {
my ($file1, $file2) = @_;
- compare_not($file1, $file2);
- compare_not($file2, $file1);
+ my ($a1, $h1) = read_file_and_hashify $file1;
+ my ($a2, $h2) = read_file_and_hashify $file2;
+
+ foreach (@$a1) { print $_, "\n" unless exists $h2->{$_} }
+ foreach (@$a2) { print $_, "\n" unless exists $h1->{$_} }
}
sub compare_not {
--
1.7.2.5
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]