The problem with all the hash-based solutions is that they lose the ordering of the arrays. If the order is important, then try this:
--foreach (@array1, @array2) { push(@array3, $_) unless $seen{$_}++; }
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: Comparing Two Arrays
by davorg
in thread Comparing Two Arrays
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |