Here there is a general scheme, and this is precisely this: it is a given intersection problem and as such can be easily solved with the help of Perl “sets”, which we tend to call hashes :).
The approach is to create a set from one of your data files (for example, indexing it into a hash table, for example: %set = (a => 1, b => 1, c => 1) , where the actual value is not significant, since we are going to test it with the "installed affiliation operator" exists ).
Once you have this, just go through another dataset and check if one of its keys (in your case, source identifiers) belongs to in %set above.
So, if the channel map file is in the following format:
ID,NAME
and the source identifier file is only one identifier per line, you can do the following:
open my $CHANNEL_MAP, q{<}, $channel_map_file_name or die $!; my %channel_map = map { chomp; my @mapping = split /,/; $mapping[0] => $mapping[1]
However, this seems a little pointless, since all you seem to want to do is filter out the channel map file using existing source identifiers. In this case, you can simply index the original identification file (use the above technique), and then just go to the channel mapping file and print each line for which the identifier exists in your source identifiers.
source share