At 11:38 AM 7/21/2003, Andrew Thomas wrote:
>Of course.... I apologize - I had meant to include that. Here it is, the actual
>script is quite long so I've pared it down some to try and isolate the problem. This
>is the whole script now and it is still having the same problem.
I'm the most newbie Perler in the world, so I hope I'm not speaking out of turn
here...
... but instead of this...
>while(<READFILE>) {
>
> $string = <READFILE>;
>
> $string =~ /^(\w+-*\w* *\w*, \w+)\|(\d+)\|(\d+)|/;
> $patientName = $1;
>
> $studyID = $2;
>
> $dateOfBirth = $3;
>
> print WRITEFILE $patientName, $studyID, $dateOfBirth;
>}
Have you tried this?
while (<READFILE>) {
my $string = $_; #opening a line
my @patientinfo = split (/ | /, $string);
my $patientName = $patientinfo[0];
my $studyID = $patientinfo[1];
my $dateOfBirth = $patientinfo[2];
print WRITEFILE "$patientName, $studyID, $dateOfBirth \n";
}
... since you've got each item on a line, and you've got a common delimiter, it just
seems like it would be easier to go line-by-line, split the line along the common
delimiter and just grab what you want that way.
... but I'm a huge Perl newbie so there may be something really obvious I'm missing
here!
Tara
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]