I basically would have the class set name then want to print that along with the (four) interval ranges.$VAR1 = { 'client_system' => { 'Customer Care' => { 'business_area' => { 'XX Business Area' => { 'component' => [ { 'component_lib' => [ { 'class_set' => { 'XX Active Strategy 2' => { 'data_type' => '1', 'linked_characteristic_name' => 'ACLI-DAT +A.X9999-ACLI-4-MTH-AVG-UTIL', 'version' => '2.0', 'is_protected' => 'false', 'obj_info' => { 'XX Active Strategy 2' => { 'obj_revision' => '1', 'version' => '2.0', } }, 'base_class_set' => [ { 'interval' => { '500-899' => { 'outcome' => { '500-899' => { 'uniqueID' => '4', 'displayPosition' => '3' } }, 'range' => [ '500-899' ], 'is_Others' => [ 'false' ] }, 'low-199' => { 'outcome' => { 'low-199' => { 'uniqueID' => '2', 'displayPosition' => '1' } }, 'range' => [ 'low-199' ], 'is_Others' => [ 'false' ] }, 'Others' => { 'outcome' => { 'Others' => { 'uniqueID' => '1', 'displayPosition' => '214 +7483647' } }, 'is_Others' => [ 'true' ] }, '200-499' => { 'outcome' => { '200-499' => { 'uniqueID' => '3', 'displayPosition' => '2' } }, 'range' => [ '200-499' ], 'is_Others' => [ 'false' ] } } } ] } }, 'type' => 'class_set' } ] } ], 'analytics' => [ {} ] } }, 'signature' => 'XXXXCC', 'version' => '3.0', 'type' => 'Standalone', 'obj_info' => { 'Customer Care' => { 'obj_revision' => '-1', 'version' => '2.0', } } } }, 'version' => '2.1', 'buildNumber' => 'Version 1.3' };
Basically need to traverse down this tree:#!/usr/bin/perl use strict; use XML::Simple; use Data::Dumper; my $file = 'files/data.xml'; my $xs1 = XML::Simple->new(); my $doc = $xs1->XMLin($file, forcearray => 1); foreach my $key (keys (%{$doc->{client_system}})){ print $doc->{client_system}->{$key} . "\n"; print $doc->{client_system}->{$key}->{'business_area'} ? ; }
Any help is appreciated.'client_system' => { 'Customer Care' => { 'business_area' => { 'XX Business Area' => { 'component' => [ { 'component_lib' => [ { 'class_set' => { 'XX Active Strategy 2' => { 'base_class_set' => [ { 'interval' => { '500-899' => { 'low-199' => { 'Others' => { '200-499' => {
In reply to XML::Simple Multi-Layered by eide
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |