in reply to Selective Check of Multiple Arrays With Single Construct
Then the code to compare A to both B and C could have just been a loop changing an index or key value. This is especially true if you're about to introduce D, E, F as you say in your last paragraph.my %data; $data{A} = [qw(a data goes here)]; $data{B} = [qw(b data here too)]; $data{C} = [qw(and here is c data)];
For example, here's a quick way to invert the index, and figure out which elements each item is in (presuming simple keys):
For "data", this will reveal "ABC". For "goes" this will be "A", and so on.my %seen_in; for my $key (sort keys %data) { for my $value (values %{$data{$key}}) { $seen_in{$value} .= $key; } }
|
|---|