I want a method in perl to do the following operation sample xml file
<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank>1</rank>
<year>2008</year>
<gdppc>141100</gdppc>
<neighbor name="Austria" direction="E"/>
<neighbor name="Switzerland" direction="W"/> First Country
</country>
<country name="Singapore">
<rank>4</rank>
<year>2011</year>
<gdppc>59900</gdppc>
<neighbor name="Malaysia" direction="N"/> Second Country
</country>
<country name="Panama">
<rank>68</rank>
<year>2011</year>
<gdppc>13600</gdppc>
<neighbor name="Costa Rica" direction="W"/>
<neighbor name="Colombia" direction="E"/> Third Country
</country>
</data>
when i enter the elment rank as a input,then the output should be like below.
<?xml version="1.0"?>
<data>
<country name="Liechtenstein">
<rank>1</rank>
</country>
<country name="Singapore">
<rank>4</rank>
</country>
<country name="Panama">
<rank>68</rank>
</country>
</data>