Monks, I have two arrays @union and @ICUNAV.
@union = ((SDT,`1781183799.44927\',-----), (BN,`1781183799.44972\',-----), (BNN,`1781183799.46753\',-----)); @ICUNAV = ((BN,`1781183799.44972\',-----), (BNN,`1781183799.46753\',-----),(SFG,`1781183799.46753\',-----));
I am trying to find the new elements in @ICUNAV which dows not exist in @union. The result i am getting is:
@diff = ((SDT,`1781183799.44927\',-----), (SFG,`1781183799.46753\',-----));
What I want is
@diff = (SFG,`1781183799.46753\',-----);
my @diff; my @inter; my %count2 = (); foreach my $element (@union,@ICUNAV) { $count2{$element}++; }; foreach my $element (keys %count2) { push @{ $count2{$element} > 1 ? \@inter : \@diff }, $element; }; print Dumper(@diff),"\n";
I am new in Perl.Your help will be appreciated
In reply to Array Difference for Two Dimentional Array! by nashkab
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |