sandy1028 has asked for the wisdom of the Perl Monks concerning the following question:
@union = @intersection = @difference = (); %count = (); foreach $element (@array1, @array2) { $count{$element}++ } foreach $element (keys %count) { push @union, $element; push @{ $count{$element} > 1 ? \@intersection : \@diff +erence }, $element; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Difference of array
by CountZero (Bishop) on May 15, 2009 at 09:09 UTC | |
|
Re: Difference of array
by moritz (Cardinal) on May 15, 2009 at 08:36 UTC | |
by almut (Canon) on May 15, 2009 at 09:09 UTC | |
by moritz (Cardinal) on May 15, 2009 at 09:18 UTC | |
| |
|
Re: Difference of array
by wol (Hermit) on May 15, 2009 at 10:11 UTC |