in reply to perl task3
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:
As for your lines that are causing the warnings (in the version of the OP that I saw), here are some hints:... while (<DATA>) ... __DATA__ >some:header|text|foo:bar|blah WHATEVER:DATA|WOULD:DEMONSTRATE|THE:PROBLEM ...
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).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 ... }
|
|---|