Hi there
I have two files "signal" which contain a list of all possible molecules. For example
and another file "orderednames" which is tab delimited containing some of the molecules and their other names5-HT 5-HT1BR serotonin MAP-kinase MAPK MAP-kinase-kinase
5-HTt serotonin MAP-kinase MAPK ERK
I would like to print all the molecules in "signal" which are not in the tab delimited file "orderednames"
At the moment my code prints out if the tokens from the tab file match from the signal molecules file which is sort of the oppisite of what I want.
use strict; use warnings; my $tok; my @tokens; my %hash; open INFILE, "<signal.txt" or die "can't open file"; while (<INFILE>) { chomp; $hash{$_} = undef; } close INFILE; open DATA, "<orderednames.txt" or die "can't open sentences"; while (<DATA>) { @tokens = split(/\t+/, $_); foreach $tok (@tokens) { if (exists($hash{$tok})) { print " match $tok \n" ; last; } else { print "$tok not match \n"; } } } close DATA; exit;
Thanks for your help in advance
In reply to searching and printing what is wanted by snowy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |