[Perl-unix-users] parsing multiple arrays

2004-08-17 Thread Mehta, Perdeep
Hi, I have a set of 8 1D arrays each containing around 100 to 150 ids. I want to recursive parse each array to find what is common and unique across all 8 arrays and print that out. Does any one know of an algorithm or has an idea that recursively could do the task? Thanks in advance for your

Re: [Perl-unix-users] parsing multiple arrays

2004-08-17 Thread David Greenberg
It's not recursive, but it should do the job... my %ids = (); foreach (@arr1) { $ids{$_}++;} ... foreach (@arr8) { $ids{$_}++;} foreach (keys(%ids)) { print $_ if $ids{$_} == 8; } This assumes that each array contains only unique ids. -David On Tue, 17 Aug 2004 08:53:21 -0500, Mehta, Perdeep <[

RE: [Perl-unix-users] parsing multiple arrays

2004-08-17 Thread Thomas, Mark - BLS CTR
In general, when you have basic algorithmic task such as below, I recommend first using http://search.cpan.org to find out if someone has packaged the functionality you need as a module. Usually you find such a module. And in fact, I found List::Compare, which seems to do exactly what you have requ