gube has asked for the wisdom of the Perl Monks concerning the following question:
Hi, monks i want to remove last index heading empty tags and also the corresponding index entry tag.
I use this code for my file i am getting error, printing output only closing </index>
undef $/; open(IN, "d:\\xyz.txt") || die "Cannot Open file\n"; $str = <IN>; $str =~ s#<index-entry id=".*?"><index-heading></index-heading>\n</ind +ex-entry>##gsi; print $str; Input : <index-entry id="idx-12427"> <index-heading>Zone of proximal development</index-heading><intra-ref +refid="00067.p0040" locator-type="pii" locator="B0126574103000672"><b +>3</b>47</intra-ref> <index-entry id="idx-12428"><index-heading>definition</index-heading>< +intra-ref refid="00067.g0040" locator-type="pii" locator="B0126574103 +000672"><b>3</b>45</intra-ref> </index-entry> </index-entry> <index-entry id="idx-12429"><index-heading></index-heading> </index-entry> </index>
Thanks in advance.
Gubendran
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pattern Matching
by gopalr (Priest) on Feb 01, 2005 at 09:16 UTC | |
|
Re: Pattern Matching
by si_lence (Deacon) on Feb 01, 2005 at 09:10 UTC | |
|
Re: Pattern Matching
by borisz (Canon) on Feb 01, 2005 at 08:52 UTC |