On Thu, Jul 12, 2001 at 11:32:27PM -0400, J�rg Ziefle wrote:
> Here's my first post to FWP.  I hope it doesn't suck too much. :)

It doesn't suck at all :-)

> @ary1 = qw/1 2 3 4 5 6 7 8 9/;
> @ary2 = qw/2 4 6 8 10/;


> @ary1 = grep { my $f = $_; !scalar grep { $_ eq $f } @ary2 } @ary1;
> 
> print "@ary1\n";

You can do this more efficiently (i.e. O(M + N) rather than O(M x N))
using something like:

@ary2{@ary2} = ();
@ary1 = grep !exists $ary2{$_}, @ary1;
print "@ary1\n";

 .robin.

-- 
"Do nine men interpret?" "Nine men," I nod. 

Reply via email to