in reply to how to convert two lists into adjacency matrix
This is a fairly straightforward task using hashes. First iterate over your first list and increment the value on that key, i.e.
my %hash = (); foreach my $element (@list1) { $hash{$element}++; }
Repeat for the second list, and voila, if a key has a value of 2, it's in both lists. Post some code, and then we can help you debug it.
Update: Or if you don't want to write any code, you could always use List::Compare::Functional.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: how to convert two lists into adjacency matrix
by QM (Parson) on Apr 14, 2009 at 19:38 UTC | |
by jaybode (Initiate) on Nov 06, 2009 at 13:59 UTC | |
by jaybode (Initiate) on Nov 06, 2009 at 14:00 UTC |