in reply to Re: Extract XML data in perl
in thread Reaped: Extract XML data in perl

Its almost same..just trying with different approach to get it sorted.. code as below,
my $data = XMLin("a_def.xml", KeyAttr => { AlertDefinition => 'id' }, +ForceArray => ['AlertDefinition','id']); print Dumper $data; print $data->{AlertDefinition}->{name}; }

Replies are listed 'Best First'.
Re^3: Extract XML data in perl
by Corion (Patriarch) on Oct 01, 2015 at 12:26 UTC

    So, what does your program output and how does it fail? How is that different from what you expect?

    See Data::Dumper for inspecting the data structure you have and References Quick Reference for how to access the data within the data structure.

      Compressed Ouput as below,
      VAR1 = { 'Status' => 'Success', 'Definition' => { '31128' => { 'priority' => '3', 'R' => { ' 'id' => '38873' }, 'ctime' => '1438886368631', 'parent' => '12118', 'count' => '0', 'mtime' => '1438886368631', 'name' => `Apple` } '31351' => { 'priority' => '3', 'R' => { ' 'id' => '53328' }, 'ctime' => '1438886368631', 'parent' => '12118', 'count' => '0', 'mtime' => '1438886368631', 'name' => `Orange` }
      expected output is only names (apple,orange)