It looks like you updated the OP in response to the advice from CountZero -- you really should have added a comment to say that you made the update, so that it's easier for the rest of us to understand what is going on.

You should have also made a comment about whether his suggestion made any difference in the problem. (Since you are now showing the line numbers in the code that cause the "uninitialized values" warnings, I guess you are still having a problem.)

Another nice gesture would be to remove stuff from the OP code that has nothing to do with the problem -- e.g. we don't need to see those nonsense lines at the end that are commented out, and the "%s2a" hash that you declare is never used, so why have it there?

Providing some sample data would help a lot, too. Instead of showing the file name that you open for reading (which doesn't help us at all, since we don't have that file), you could use the "DATA" file handle, and include just enough data at the end of your posted code, like this:

... while (<DATA>) ... __DATA__ >some:header|text|foo:bar|blah WHATEVER:DATA|WOULD:DEMONSTRATE|THE:PROBLEM ...
As for your lines that are causing the warnings (in the version of the OP that I saw), here are some hints:
foreach $value (@e) { my @elements= split(/\|/, $value); ... # next 2 lines assume that $value had at least 6 strings # separated by "|" (but maybe it only had 2): my @missedc = split (/:/, $elements[2]);#60 ... my @s = split(/:/, $elements[5]);#62 my $sequence = $s[1]; # when the assignment to @s warns and fails (because # @elements < 6) the next line will also warn and fail: my @peptides = split (/ /, $sequence);#65 ... # and so will this line: my $output = "$headers[1]\t\t$peptide\t\t$total \t\t 1 \t\t$mi +ssed\t$sequence\n";#72 ... }
So the point is, the various warnings are all related, and the source of the problem is probably in your data (or in your untested assumptions about the data).

In reply to Re: perl task3 by graff
in thread perl task3 by huzefa

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.