rsriram has asked for the wisdom of the Perl Monks concerning the following question:
Hello all,
I have a tagged text file as below:
<tag1>Complete</tag1><tag2>3386</tag2><tag3>77844</tag3><tag4>11</tag4><tag5>30</tag5><tag6>4.7</tag6>If the content of <tag1> is "Complete", the content of <tag6> should be multiplied by 100. I tried the following code but did not work. Can someone help me on this?
if($_ =~ /<tag1>Complete<\/tag1>/) { $_ =~ s/<tag6>(.+?)<\/tag6>/<tag6>$1 * 100<\/tag6>; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Manipulating a string in a tagged file
by GrandFather (Saint) on Mar 12, 2007 at 11:07 UTC | |
Re: Manipulating a string in a tagged file
by Samy_rio (Vicar) on Mar 12, 2007 at 11:00 UTC | |
Re: Manipulating a string in a tagged file
by ides (Deacon) on Mar 12, 2007 at 22:56 UTC |