On Fri, Jan 30, 2004 at 07:48:35AM -0700, Wiggins d Anconia wrote: > Going to need more info about what you think this looks like it should > do, because I (and maybe others here) lack the math skills to get your > answer, funny, I got [9,8,7]. Thats what I get for not profraedinng, the result should be: @c = [9,8,7]
> > @a=([1,2,3],[5,5,5],[9,8,7]);
> > @b=([5,5,5],[1,2,3]);
> > @[EMAIL PROTECTED]@b;
> The obvious things are inside your head, my obvious thing would be to go
> immediately to CPAN and look for the formal name of whatever it is you
> are attempting, one (mediocre at best) guess would be to start at either:
Well, I ended up having to write a function, it wasn't quite as ugly as
I thought (pasted below, for the benefit of others). However, if there
was a better way, I'd like to know how :)
Heres what I got (odd seeming indents courtisy of emacs):
#####
# subArray - takes two array references, and subtracts any instances
# of the arrays in the second one from the first one. Returns the new list.
sub subArray {
my @a = @{ shift() };
my @b = @{ shift() };
my @c;
OUTER: foreach my $outer (@a) {
INNER: foreach my $inner (@b) {
next OUTER if ($outer == $inner);
}
push @c, $outer;
}
return @c;
}
--
Robin <[EMAIL PROTECTED]> JabberID: <[EMAIL PROTECTED]>
Hostes alienigeni me abduxerunt. Qui annus est?
PGP Key 0x776DB663 Fingerprint=DD10 5C62 1E29 A385 9866 0853 CD38 E07A 776D B663
pgp00000.pgp
Description: PGP signature
