note
tangent
It looks to me that this is not doing what you think:
<code>
my %count = ();
foreach my $device (@current_list, @temp_devicelist) {
$count{$device}++;
}
</code>
as those arrays are in fact arrays of arrays. Try getting rid of that and putting <c>my %count</c> at the top of your sub and counting within the other loops:
<code>
my %count;
# ...
for ($n=0; $n < $size; $n++) {
our $device=$current_list[$n][0];
$count{$device}++;
}
# ...
for ($n=0; $n < $size; $n++) {
our $tempdevicelinks=$temp_list[$n][0];
$count{$tempdevicelinks}++;
}
# ...
my @difference = grep { $count{$_} == 1 } keys %count;
my @intersect = grep { $count{$_} == 2 } keys %count;
my @union = keys %count;
</code>
Then you can print out the values:
<code>
print "Difference:\n";
print "$_\n" for @difference;
print "Intersect:\n";
print "$_\n" for @intersect;
print "Union:\n";
print "$_\n" for @union;
</code>
1079630
1079630