Hello All,
I've run into a problem I am not able to solve myself because I don't know what perl exactly does when I try to use the exist function.
My script does the following:
first i use a database to build up a hash, this hash has has then around 800000 values divided over 2300 keys.
Then I use a file with which I must examine whether a component exists in that hash. If the value exists it simply adds 1 to the number of times the value was found. A value can exist in combination with multiple keys.
Now when I count the number of values before the counting and after the counting the computer comes up with different numbers which should, in my view, be impossible.
A piece of my code looks like this:
when I print out a chromosomic location ($chrompos) the value is changed after the second exist function. This only happens in very rare cases but when it happens values gets added to my hash.
Does anyone knows what goes wrong here and how to solve it?
Thanks in advance.
Regards
Karel
I've run into a problem I am not able to solve myself because I don't know what perl exactly does when I try to use the exist function.
My script does the following:
first i use a database to build up a hash, this hash has has then around 800000 values divided over 2300 keys.
Then I use a file with which I must examine whether a component exists in that hash. If the value exists it simply adds 1 to the number of times the value was found. A value can exist in combination with multiple keys.
Now when I count the number of values before the counting and after the counting the computer comes up with different numbers which should, in my view, be impossible.
A piece of my code looks like this:
Code:
$chrompos = $chromosome."_".$position; $test_loc=$position+$lengthreads-1; $test_pos = $chromosome."_".$test_loc; foreach $exon_id(keys %exon_hash){ if (exists $exon_hash{$exon_id}{$chrompos}){ if (exists $exon_hash{$exon_id}{$test_pos}){ for ($i=0;$i<$lengthreads;$i++){ $next_position=$position+$i; $x= $chromosome."_".$next_position; $exon_hash{$exon_id}{$x}{amount}++; } } } }
Does anyone knows what goes wrong here and how to solve it?
Thanks in advance.
Regards
Karel
Comment