Okay, so it's a small piece of fun, but I was pleased with it. Problem: multiple files containing essentially identical reports which I want to compare. 'diff' isn't the answer; in this case each file contains a bunch of stuff I'm not interested in that can change; I just want to get an element of each one and say which of the other files don't contain that element.
E.g., if we have a file file1 containing the line "My dog's name is Spot" and file2 contains that line and also the line "My dog's name is Rex", and I'm comparing dogs, I'd want to output In file2 but not file1: Rex So this program would print that by being invoked with: fdiff 'name is (\w+)' file[12] my $regex = shift; my %data; while (<>) { next unless /$regex/; $data{$ARGV}{$1}++; } for my $outer (keys %data) { my @others = grep $_ ne $outer => keys %data; for my $inner (keys %{$data{$outer}}) { for my $other (@others) { unless (exists $data{$other}{$inner}) { print "In $outer but not $other: $inner\n"; } } } } Like I said, a small piece of fun, but I was pleased with how it wrote itself in about a minute. -- Peter Scott http://www.perldebugged.com/ *** NEW *** http//www.perlmedic.com/