<div dir="ltr"><div>Please excuse the test message in reply to Paul's Message.  I did some printf's in the code to test the output.  The result Paul is seeing is only on the first record and it's happening in the first occurance of:</div><div><br></div><div>my $firstDir = substr ($patientId...</div><div><br></div><div>if I print the values of $patientId and $hospitalId before the substr the data appears to be correct.</div><div><br></div><div>I also tried something since the data is numeric in nature.  I tried:</div><div>my $patientId = int $ids[0];</div><div><br></div><div> which resulted in the following as an error since it's not text.</div><div><br></div><div>M-oM-;M-?514027<br></div><div><br></div><div>So it appears to be something that's happening with the substr and the data in the file.  I see no special characters in the file itself using vi :set list  I also did a dos2unix on the file to make sure it's using the right format.   I have read that there are problems with perl and files in UTF-8 format.  Is that a potential problem?</div></div>