<?xml version="1.0" encoding="windows-1252"?>
<node id="964792" title="Re: Strange output problem" created="2012-04-12 13:24:14" updated="2012-04-12 13:24:14">
<type id="11">
note</type>
<author id="892462">
Riales</author>
<data>
<field name="doctext">
&lt;p&gt;Nothing jumps out at me, but I am inclined to agree with your guess about the problem being in the last part of the code. Have you tried adding print statements before the chomp, before the substitution, and after the substitution?&lt;/p&gt;

&lt;code&gt;
while (&lt;$new_in_file&gt;) {
    print "BEFORE CHOMP: $_\n";
    chomp;
    next          if $. == 1;   # remove header line
    s/POS/SAMPLE/ if $. == 2;
    s/\s+/,/g     if $. == 2;   # replace whitespace with a comma on ID row
    next          if $. &gt;= 3 and $. &lt;= 9;   # remove unwanted lines
    print "BEFORE SUBSTITUTION: $_\n"; 
    s/\s+(\d)\|(\d)\S+/,$1 $2/g;    # clean up the SNPs &amp; put into CSV format
    print "AFTER SUBSTITUTION: $_\n";
    print $new_out_file "$_\n";
}
&lt;/code&gt;</field>
<field name="root_node">
964788</field>
<field name="parent_node">
964788</field>
</data>
</node>
