|more useful options|
If statement problem with hash valuesby MonkPaul (Friar)
|on Jun 15, 2005 at 17:01 UTC||Need Help??|
MonkPaul has asked for the
wisdom of the Perl Monks concerning the following question:
Further to my problems i posted yesterday i cannot seem to get the program to recognise information stored in one file and compare it to another file.
This is some of the code a colleague gave me to get it to recognise an Accession number in one file and compare it to an element in an array, obtained from a second file.
The $ref_filehandle holds the data from the reference file that contains only a list of Accession numbers, i.e.
Where as the @subjects holds in each element :
gi|14670349|ref|NM_032999.1| Homo sapiens general transcription factor II, i (GTF2I), transcript .... or a derivetive of.
The problem i have is that the hash %refList holds all the accession numbers in KEY = Accession VALUE = Accession, so both accession values are stored in key and value - should be an array i know but i need speed when searching through for each element of @subjects, hence the use of "defined" function.
I have found, using print statements, that the hash does have the right values stored in it, but when searched for $elements element it cant find it, so i tried "! defined" - and guess what, it equates to true. Knowing that the values are stored in the hash i can only assume the problem lies with the if statement.
Any help is really appreciated - including any critical appraisal as its not my handy work.