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++; }
In reply to Re: Hash making
by friedo
in thread Hash making
by sesemin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |