in reply to confirming key in xml?
You can use XML::Simple to do modifications too:
Update:'KeepRoot' was added in according to AM's comments below.use XML::Simple; my $inst_set = XMLin( 'test.xml', KeepRoot => 1 ); foreach my $Channel (@{$inst_set->{Settings}->{Channels}->{Channel}}) +{ if ( $Channel->{Voltage} ) { print "Old voltage: $Channel->{Voltage} -- "; $Channel->{Voltage} *= 2.0; print "New voltage: $Channel->{Voltage}\n"; } } my $xml = XMLout( $inst_set, KeepRoot => 1 ); print $xml;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: confirming key in xml?
by Anonymous Monk on Apr 06, 2015 at 21:59 UTC | |
|
Re^2: confirming key in xml?
by Anonymous Monk on Apr 06, 2015 at 22:20 UTC | |
by pme (Monsignor) on Apr 06, 2015 at 22:54 UTC | |
|
Re^2: confirming key in xml?
by karlgoethebier (Abbot) on Apr 07, 2015 at 18:28 UTC |