shawshankred has asked for the wisdom of the Perl Monks concerning the following question:
Here is my Perl Code$VAR1 = { 'Dev' : { 'NM' : { 'nmsAc' : 'Unknown', 'nmsA' : '0.0.0.0:0' }, 'eve' : { 'alert' : '1', 'debug' : '1' }, 'Com' : { 'cost' : '1', 'stre' : 'nco', }, 'VeCog' : { 'Operations' : { 'A' : { 'Value' : '1', 'Desc' : 'Minmess' }, 'B' : { 'Value' : '10', 'Desc' : 'Minmess' }, 'C' : { 'Value' : '100', 'Desc' : 'Minmess' }, 'D' : { 'Value' : '1000', 'Desc' : 'Minmess' }, } 'disc' : { 'con' : '0.0.0.0:0', 'int' : 'None' } } } };
I can print the value of element C with the print statement but I cant get the names of the elements A, B, C and D under the Element Operations. I want to be able to print the Key value pairs likeuse XML::Simple; use Data::Dumper; $xml = new XML::Simple; $data = $xml->XMLin("/home/nager.xml"); print "$data->{Dev}->{VeCog}->{Operations}->{C}->{Value}\n";
How do I do that.A:1 B:10 C:100 D:1000
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to access the HAsh Reference Elements and Value from XML::Simple out put
by AnomalousMonk (Archbishop) on Sep 16, 2010 at 22:42 UTC | |
by shawshankred (Sexton) on Sep 17, 2010 at 13:53 UTC | |
|
Re: How to access the HAsh Reference Elements and Value from XML::Simple out put
by JavaFan (Canon) on Sep 16, 2010 at 20:58 UTC | |
by shawshankred (Sexton) on Sep 17, 2010 at 13:51 UTC |