pinnacle has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to remove tag "INFO" and it's content from the file and print the remaining file but can't get result, I am not sure what going wrong please help!!
<COMPLETE> <T>test</T> <L>light</L> <INFO>information</INFO> </COMPLETE> <COMPLETE> <T>test</T> <L>light</L> <INFO>informa</INFO> </COMPLETE> Above xml is in file 'test.xml' open(OUT,"/home/test.xml"); while(<OUT>){ $line = $_; if($line =~ m#<INFO>(.+?)</INFO>#ig) { next; } print "$line\n"; }
When I run the above code I only get:
<COMPLETE> <T>test</T> <L>light</L> <INFO>information</INFO> </COMPLETE>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: parsing xml
by toolic (Bishop) on Apr 06, 2011 at 18:39 UTC | |
by mirod (Canon) on Apr 07, 2011 at 07:37 UTC | |
|
Re: parsing xml
by wind (Priest) on Apr 06, 2011 at 18:35 UTC | |
|
Re: parsing xml
by Jenda (Abbot) on Apr 07, 2011 at 13:24 UTC | |
|
Re: parsing xml
by locked_user sundialsvc4 (Abbot) on Apr 07, 2011 at 15:30 UTC | |
|
Re: parsing xml
by perl_addict (Initiate) on Apr 07, 2011 at 05:46 UTC |