in reply to Re^2: how can I print my hash values once?
in thread how can I print my hash values once?

Just a quick note, you seem to be placing some garbage in your hash:

Chromosome has X genes Chromosome KLHL13 has X genes Chromosome UTY has Y genes Chromosome SPIN2B has X genes Chromosome PIR has X genes

The values in the hash should only be counts. Once you fix that bug, you can use

foreach my $geneid ( sort { $geneids{$a} <=> $geneids{$b} } keys %geneids ) { if ($geneid =~ /^(?:[0-9]+|X|Y)\z/) { print OUT "Chromosome $geneid has $geneids{$geneid} genes\n"; } }

Replies are listed 'Best First'.
Re^4: how can I print my hash values once?
by lomSpace (Scribe) on Mar 11, 2011 at 15:17 UTC
    Ikegami,
    I removed the garbage lines by counting them then I used a perl one liner at the command line to remove the the unwanted garbage lines
    I would have preferred to fix that bug within the code.
    DeepSpace
      Then merge your one liner into "the code".