in reply to Reaped: Extract XML data in perl

How is this question substantially different from your previous question on this topic?

Maybe you want to show the Perl code you already wrote and tell us how it fails to perform what is needed?

Replies are listed 'Best First'.
Re^2: Extract XML data in perl
by Ping_Bee (Initiate) on Oct 01, 2015 at 11:57 UTC
    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}; }

      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)