perl programming?
Sample Data:
<tocelement name="New classification and
<tocelement name="Gestational diabetes mellitus
<tocelement name="Glycohaemoglobin: a
1997" ca= "ANZ"
<tocelement name="The prevention
<tocelement name="Diabetes and
</tocdivision>
Program:
while (<TEMP1>)
{
$CountTB=substr $_,0,1;
print $CountTB;
if ($CountTB eq "<")
{
print TEMP2 $_;
}
else
{
print "OK";
print "\b", TEMP2 $_;
}
}
Problem:
I want the " 1997......" to be in 1 line before it. Meaning all lines must first start with "<" since the file is an xml. how am i gonna do it. i have a sample program but everytime i ran it, it stops at the sntence " 1997......" please help????
Correct output i want:
<tocelement name="New classification and
<tocelement name="Gestational diabetes mellitus
<tocelement name="Glycohaemoglobin: a 1997" ca= "ANZ"
<tocelement name="The prevention
<tocelement name="Diabetes and
</tocdivision>
|