in reply to Re^2: Merging Arrays without duplicates
in thread Merging Arrays without duplicates
@seen{@A} = ();
is the same as
$seen{$A[0]}) = undef; $seen{$A[1]}) = undef; $seen{$A[2]}) = undef; $seen{$A[3]}) = undef; ...
@merged = (@A, grep{!exists $seen{$_}} @B);
is the same as
@C = grep{!exists $seen{$_}} @B; @merged = (@A, @C);
@C = grep{!exists $seen{$_}} @B;
@C is assigned the contents of @B not seen in %seen. In other words,
@C is assigned the contents of @B not seen in @A.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Merging Arrays without duplicates
by perl_krish (Initiate) on Aug 18, 2004 at 19:16 UTC | |
by ikegami (Patriarch) on Aug 18, 2004 at 20:22 UTC |