#!/usr/bin/perl use strict; use warnings; use Data::Dumper; $Data::Dumper::Indent = 1; my $v = get_hashref(); my $s = $v-> {client_system} {'Customer Care'} {business_area} {'XX Business Area'} {component}[0] {component_lib}[0] {class_set}; my ($name) = keys %{$s}; print "$name\n"; my $t = $s-> {$name} {base_class_set}[0] {interval}; for my $key (keys %{$t}){ if (exists $t->{$key}{range}){ print "$t->{$key}{range}[0]\n"; } } #print Dumper $t; sub get_hashref{ return { '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' }; }
output:
Is this something like you were after?XX Active Strategy 2 low-199 500-899 200-499
update: the OP added more info while I was posting.
In reply to Re: XML::Simple Multi-Layered
by wfsp
in thread XML::Simple Multi-Layered
by eide
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |