The code sample you provide doesn't match the sample data you provide and you don't show the expected output for the sample data so the following is rather a guess:

use strict; use warnings; my %clone_hash; while (<DATA>) { chomp; next if ! length; my ($gene_symbol, $esc_qc) = split /\s+/; $clone_hash{$gene_symbol}{$esc_qc}++; } my $okGenes = 0; my $singleOks = 0; foreach my $key (sort keys %clone_hash) { my $gene = $clone_hash{$key}; my $okPasses = grep {defined} @{{%$gene}}{qw(pass1 pass2 pass3)}; my $badPasses = keys (%$gene) - $okPasses; if ($badPasses) { ++$singleOks if $okPasses == 1; } else { ++$okGenes; } } print "Ok genes: $okGenes\n"; print "Single pass genes: $singleOks\n"; __DATA__ Eif2b2 fail Eif2b2 pass5 Eif2b2 fail Eif2b2 pass2 Eif2b2 fail Eif2b2 pass4 Eif2b2 fail 49334 fail 49334 fail 49334 pass1 49334 fail 49334 pass4 Oxct1 pass4 Oxct1 fail Oxct1 pass4 Oxct1 fail

Prints:

Ok genes: 0 Single pass genes: 2

True laziness is hard work

In reply to Re: processing key value pairs of a hash by GrandFather
in thread processing key value pairs of a hash by lomSpace

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.