Text file is ~2800 lines like the following:
Lastname, Firstname|1|137|10_3|10/13/01|...........etc.
(I have examined this carefully, and every line although very long does end with a newline character)
And My script includes the following:
#!/usr/bin/perl
system "clear"; print "Welcome to Andy's Data Processor...\n";
open(WRITEFILE, ">Output.txt") or die "Couldn't open WRITEFILE for preparation.";
print WRITEFILE "Patient Name|Study ID|Date of Birth|Medical Rec Num|Obs End Date|Months of Obs|Month of Obs|Month of Year|Year|ID_Rec|CC Status|Acute OV|ED Visits|Telemed Visits|WCC Visits|Non-Acute OV|\n";
print "Opening ReadFile(s)...\n\n\n";
open (READFILE,"events.txt") or die "Couldn't open READFILE.";
while(<READFILE>) {
$string = <READFILE>;
$string =~ /^(\w+-*\w* *\w*, \w+)\|(\d+)\|(\d+)|/; $patientName = $1;
$studyID = $2;
$dateOfBirth = $3;
print WRITEFILE $patientName, $studyID, $dateOfBirth; }
close READFILE;
close WRITEFILE;
That is the whole script - and it still outputs only half the lines. I'm pretty much stumped - and starting to think that maybe perl isn't the best solution for this project...... Hope someone out there can help.
-Andy
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]