#!/xce/bin/perl -w use warnings; opendir(DIR, ".") or die "cannot open directory"; @docs = grep(/\.xml$/,readdir(DIR)); foreach $file (@docs) { open (INFILE, "$file") or die "could not open $file\n"; # Process error data to rectify the error records in massaged data while () { while(/

\s*([^\000]*?)<\/text>\s*<\/p>/){ $temp=$1; $temp=~s///gmi; $temp=~s///gmi; s/

\s*[^\000]*?<\/text>\s*<\/p>/

\n$temp<\/TEXT>\n<\/P>/; } s/(<\/?)TEXT/$1text/gm; s/(<\/?)P/$1p/gm; print $_; # Output the contents of $_ to # output file } #Close the infile. close(INFILE); }