Anonymous Monk 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 : \@difference + }, $element; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: tweaking of perldoc function (sorting/preserving order)
by ikegami (Patriarch) on Jan 18, 2008 at 01:43 UTC | |
by lodin (Hermit) on Jan 18, 2008 at 08:42 UTC | |
|
Re: tweaking of perldoc function (sorting/preserving order)
by almut (Canon) on Jan 18, 2008 at 01:42 UTC | |
|
Re: tweaking of perldoc function (sorting/preserving order)
by poolpi (Hermit) on Jan 18, 2008 at 09:10 UTC | |
by lodin (Hermit) on Jan 18, 2008 at 20:47 UTC | |
|
Re: tweaking of perldoc function (sorting/preserving order)
by lodin (Hermit) on Jan 18, 2008 at 08:44 UTC |