It is parsed like this:
#!/usr/bin/perl -w
use strict;
my $key = 'JUMP';
if (
($key eq 'ID')
or ('TITLE')
or ('GENE')
or ('CYTOBAND')
or ('LOCUSLINK')
or ('CHROMOSOME')
or ('SCOUNT')
) {
print "I don't know why this is printing.\n";
}
and the chain of or's is broken at the first true
statement. Namely 'TITLE'. You need to put a lot more "$key eq" statements in there.
The other common options are:
if (grep {$key eq $_} qw(ID TITLE GENE CYTOBAND LOCUSLINK CHROMOSOME S
+COUNT)) {
print "This didn't print, did it?\n";
}
or put the list in a hash and write the test as:
if (exists $is_valid{$key}) {
print "Key '$key' is a valid key\n";
}