summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2012-04-09 16:19:20 -0400
committerJoey Hess <joey@kitenet.net>2012-04-09 16:19:20 -0400
commit4549f5d3e3ac049668bd41b7d3de214c7826f69b (patch)
tree30b297f4bb9c300492c50440d9c83649a69b06d5
parentbbfa7f9a5d262d13c825005f89410f464148fd1d (diff)
downloadmoreutils-4549f5d3e3ac049668bd41b7d3de214c7826f69b.tar.gz
cleanup
-rwxr-xr-xcombine24
1 files changed, 12 insertions, 12 deletions
diff --git a/combine b/combine
index 13fc2e4..99a4de6 100755
--- a/combine
+++ b/combine
@@ -105,30 +105,30 @@ sub compare_or {
sub compare_xor {
my ($file1, $file2) = @_;
- my ($lines2, $seen2) = ([], {});
+ my (@lines2, %seen2);
filemap $file2,
sub {
- push @$lines2, $_;
- $seen2->{$_} = 1;
+ push @lines2, $_;
+ $seen2{$_} = 1;
};
+ # Print all lines in file1 that are not in file2,
+ # and mark lines that are in both files by setting
+ # their value in %seen2 to 0.
filemap $file1,
sub {
- # Print all lines in file1 that are not in file2,
- # and mark lines that are in both files by setting
- # their value in %seen2 to 0.
- if (exists $seen2->{$_}) {
- $seen2->{$_} = 0;
+ if (exists $seen2{$_}) {
+ $seen2{$_} = 0;
}
else {
print "$_\n";
}
};
- foreach (@$lines2) {
- # Print all lines that are in file2 but not in file1.
- # The value of these lines in seen2 is set to 1.
- print "$_\n" if $seen2->{$_};
+ # Print all lines that are in file2 but not in file1.
+ # The value of these lines in seen2 is set to 1.
+ foreach (@lines2) {
+ print "$_\n" if $seen2{$_};
}
}