D
DIAMOND Mark R.
My apologies to begin with. I am a relatively new, and infrequent user of
perl.
I have a series of html files with contact information for doctors. The
files have enormous amounts of other stuff in them including script, image
links and so on.
But the names all appear between a particular <span ...> tag and a </b> tag,
with the words like "level7Name" or "level2Contact" (the quotes are in the
tag) marking the particlar spans.
Line breaks don't seem to follow any particular pattern. The two structures
<span ... level.Name> .... nametoprint</b> and the equivalent for the
contact address are quite distinct without any strange embedding of the two.
What I'd like to do is print out the names, and the contact information, but
I've obviously gone wrong somewhere. I couldn't work out whether I should or
should not have a global at the end of the s///, but in either case, I still
have a problem. Any help would be very much appreciated.
$/ = ".\n";
$doctorlistfile = "c:\\tmp\\doctors.tmp";
open(DOCTORLISTFILE, "> $doctorlistfile" ) || die "Can't open
$doctorlistfile \n";
while(<>) {
s/<span +class=\"level[0-9]Name\"><b>([^<]*)<\/b>/ $1 /;
print DOCTORLISTFILE $1;
s/<span +class=\"level[0-9]Contact\"><b>([^<]*)<\/b>/ $1 /;
print DOCTORLISTFILE $1;
}
perl.
I have a series of html files with contact information for doctors. The
files have enormous amounts of other stuff in them including script, image
links and so on.
But the names all appear between a particular <span ...> tag and a </b> tag,
with the words like "level7Name" or "level2Contact" (the quotes are in the
tag) marking the particlar spans.
Line breaks don't seem to follow any particular pattern. The two structures
<span ... level.Name> .... nametoprint</b> and the equivalent for the
contact address are quite distinct without any strange embedding of the two.
What I'd like to do is print out the names, and the contact information, but
I've obviously gone wrong somewhere. I couldn't work out whether I should or
should not have a global at the end of the s///, but in either case, I still
have a problem. Any help would be very much appreciated.
$/ = ".\n";
$doctorlistfile = "c:\\tmp\\doctors.tmp";
open(DOCTORLISTFILE, "> $doctorlistfile" ) || die "Can't open
$doctorlistfile \n";
while(<>) {
s/<span +class=\"level[0-9]Name\"><b>([^<]*)<\/b>/ $1 /;
print DOCTORLISTFILE $1;
s/<span +class=\"level[0-9]Contact\"><b>([^<]*)<\/b>/ $1 /;
print DOCTORLISTFILE $1;
}