http://www.perlmonks.org?node_id=1030780

tyce has asked for the wisdom of the Perl Monks concerning the following question:

input: <p class="normal">The majority of CA-MRSA strains are sensitive + [<a id="ch1-bid.38" href="#rch1-bid.38">38</a>,<a id="ch1-bid.38" hr +ef="#rch1-bid.39">39</a>]</span>. SXT has [<a id="ch1-bid.101" href=" +#rch1-bid.101">101</a>]</span>). SXT can be considered for use in sel +ected MRSA cases where patients are not tolerant of other, more activ +e, antibiotics.</p> <h3 class="h3t">Rifampicin</h3> ############## open(file,"<chapter01.xml")or die "the Erroer line si $!"; @filelist = <file>; $coutnline=0; $count =0; foreach(@filelist) { # print $_; $tlist= $_; if($tlist =~m/id="ch1-bid.[0-9]+/i) { #print $&."\n"; $mc_line = $&; chomp; if($mc_line =~ s/(?:\s*\b$re)+$//) { print "[$_]\n"; # print "$& test1 \n";; } else { #print "not matched \n"; push(@ovr,$_) } $coutnline++; } else { push(@overlist,$_); # print "the line is over writed \n"; $count++; } } close(file); print $coutnline."\n"; print $count; #out put needs input: <p class="normal">The majority of CA-MRSA strains are sensitive + [<a id="ch1-bid.38" href="#rch1-bid.38">38</a>,<a href="#rch1-bid.38 +">38</a>]</span>. SXT has [<a id="ch1-bid.101" href="#rch1-bid.101">1 +01</a>]</span>). SXT can be considered for use in selected MRSA cases + where patients are not tolerant of other, more active, antibiotics.< +/p> <h3 class="h3t">Rifampicin</h3>
Update
input : <p class="normal">nfection <span class="small">[<a id="ch1-bi +d.1" href="#rch1-bid.1">1</a>]</span>.</p> <p class="normal">nfection <span class="small">[<a id="ch1-bid.2" href +="#rch1-bid.2">2</a>]</span>.</p> <p class="normal">nfection <span class="small">[<a id="ch1-bid.4" href +="#rch1-bid.4">4</a>]</span>.</p> <p class="normal">nfection <span class="small">[<a id="ch1-bid.4" href +="#rch1-bid.4">4</a>]</span>.</p> ----------------------------------- output : <p class="normal">nfection <span class="small">[<a id="ch1-bi +d.1" href="#rch1-bid.1">1</a>]</span>.</p> <p class="normal">nfection <span class="small">[<a id="ch1-bid.2" href +="#rch1-bid.2">2</a>]</span>.</p> <p class="normal">nfection <span class="small">[<a id="ch1-bid.4" href +="#rch1-bid.4">4</a>]</span>.</p> <p class="normal">nfection <span class="small">[<a href="#rch1-bid.4"> +4</a>]</span>.</p> ======end don't want id="ch1-bid.4" tab. pls find