I want to parse this XML file and extract some values. My script 'foo.pl' looks like this:<WHICS> <WhicsService> <Parameters> <WHICS> <Value>123.456.7.89</Value> <Detail>Name of Unix system running WHICS</Detail> </WHICS> <ServersMax> <Value>15</Value> <Detail>Maximum number of servers running on WHICS</Detail +> </ServersMax> <Service Name="WR80B"> <Runable> <Value>yes</Value> <Detail>Run WR80B process if value is yes else does not + stat WR80B</Detail> </Runable> <PortOut> <Value>4100</Value> <Detail>Default port for Unix server connections</Detai +l> </PortOut> <command> <Value>cd /whics/ahm && ./bin/wh_wweb80.sh </Va +lue> <Detail>Unix command required to run WR81B</Detail> </command> <ServersMin> <Value>7</Value> <Detail>Minimum number of servers running on WHICS</Det +ail> </ServersMin> </Service> </Parameters> </WhicsService> </WHICS>
The first two 'print' lines work fine but the third 'print line does not print 'yes', instead nothing is printed. Any pointers would be greatly appreciated! Thanks, Adam#!perl use XML::Simple; my $config = XMLin("local.xml"); print $config->{WhicsService}->{Parameters}->{WHICS}->{Value} . "\n"; +# prints '123.456.78.9' print $config->{WhicsService}->{Parameters}->{ServersMax}->{Value} . " +\n"; # prints '15' print $config->{WhicsService}->{Parameters}->{Service}->{WR80B}->{Runa +ble}->{Value} . "\n";
In reply to Problem using module XML::Simple by adam_2005
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |