in reply to Logical operations on arrays
If the order of the arrays makes no difference, it sounds like you are looking for an intersection operator of some sort. Array::Utils might have what you are looking for. I found this by searching metacpan for "union intersect".
Otherwise, a method to find them is pretty straightforward:
@hash1{@array1} = (1)x@array1
push( @intersection, grep { $hash1{$_} } @array2 );
Updates:
--MidLifeXis
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Logical operations on arrays
by Athanasius (Archbishop) on Oct 04, 2012 at 12:24 UTC | |
|
Re^2: Logical operations on arrays
by Jenda (Abbot) on Oct 04, 2012 at 23:03 UTC |