Me wrote:
> I have two data sets from two sources, each set of results is stored in
> files which are ared into @file1 and @file2.
>
> "man perlfaq4" gives an exampe of an intersection of the two. My
> problems is, I need to know which elements of @file1 are not in @file2
> and the other way around. How can I keep track of this using the example
> from the man page.
The most important part of the "perldoc -q intersection" answer is the
first sentence: "Use a hash."
The rest is an example, and you need to adopt it to fit your particular
situation.
my %count;
foreach my $element (@file1, @file2) { $count{$element}++ }
my @unique1 = grep $count{$_} == 1, @file1;
my @unique2 = grep $count{$_} == 1, @file2;
--
Gunnar Hjalmarsson
Email:
http://www.gunnar.cc/cgi-bin/contact.pl