... while () ... __DATA__ >some:header|text|foo:bar|blah WHATEVER:DATA|WOULD:DEMONSTRATE|THE:PROBLEM ... #### 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$missed\t$sequence\n";#72 ... }