in reply to Hash making
You'll need to declare your hash as a lexical (my) variable outside the loop, so it won't get clobbered each time through. Then you can add keys to it in the normal way.
However, I don't quite understand what you're trying to do with %snp_covered. You're using the same key each time ($mismatch, which is 3) and overwriting the previous value each time there's a match. If you just want to keep track of the total number of matches, you can use a plain scalar and just increment it each time:
my $count; while(<INPUT2>){ chomp; my @current_line = split /\t/; my $mismatch =3; next unless $current_line[5] == 1 && $current_line[14] >= $mismatch; $count++; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hash making
by sesemin (Beadle) on Sep 21, 2008 at 04:52 UTC | |
by ikegami (Patriarch) on Sep 21, 2008 at 05:28 UTC | |
by sesemin (Beadle) on Sep 21, 2008 at 05:44 UTC | |
by ikegami (Patriarch) on Sep 21, 2008 at 19:20 UTC |