I really didn't understand completely what you are trying to do. like what is $HoProPos{$snpID}?

Anyway 7 levels of "}" is very confusing to say the least and should be a super Red Flag.

Below I just settled for parsing the input and making a data structure. It might give you some hints on how to simplify your code. I didn't understand the basic terminology so the parsing of the line is probably more complex than need be.

A main point is that the depth level below is only 2 vs your 7 levels. The code below looks a bit strange because I don't understand the terminology or what you are trying to accomplish. I was not able to run your code.

Have fun with this...I hope that something is useful for you.

#!usr/bin/perl -w use strict; use Data::Dumper; my %Gene_DB; # a hash of hash while (<DATA>) { my $gene = (/^Gene:\s+(\S+)\s*/)[0] || next; add_gene($gene); } sub add_gene { my $gene = shift; my @tokens; my %gene_hash; while (<DATA>) { last if (/^-/); #End of Record next unless (/^\d/); #the single line we care about! @tokens = split; } #I probably don't understand OP right! #but first 3 on line, last 2 on line, then what's left over my ($Epitope, $Sequence, $Location) = splice(@tokens, 0, 3); my ($Strain, $Confidence) = splice(@tokens, -2); my ($Protein) = join (" ",@tokens); @gene_hash{'Epitope', 'Sequence', 'Location' ,'Strain', 'Confidence' ,'Protein'} = ($Epitope, $Sequence, $Location,$Strain, $Confidence,$Protein); $Gene_DB{$gene}=\%gene_hash; } print Dumper (\%Gene_DB); #prints: #$VAR1 = { # 'PF14_0747' => { # 'Protein' => 'Plasmodium falciparum', # 'Epitope' => '26850', # 'Confidence' => 'Medium', # 'Strain' => '3D7', # 'Location' => '1914-1917', # 'Sequence' => 'IKND' # }, # 'PF14_0711' => { # 'Protein' => 'Plasmodium falciparum', # 'Epitope' => '26850', # 'Confidence' => 'Medium', # 'Strain' => '3D7', # 'Location' => '9-12', # 'Sequence' => 'IKND' # } # }; # __DATA__ Gene: PF14_0747 TABLE: Epitopes from IEDB Epitope Sequence Location on Protein Strain Confidence 26850 IKND 1914-1917 Plasmodium falciparum 3D7 Medium ------------------------------------------------------------ Gene: PF14_0711 TABLE: Epitopes from IEDB Epitope Sequence Location on Protein Strain Confidence 26850 IKND 9-12 Plasmodium falciparum 3D7 Medium ------------------------------------------------------------

In reply to Re: Argument "" isn't numeric in numeric le (<=) by Marshall
in thread Argument "" isn't numeric in numeric le (<=) by hotel

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.