#!/usr/bin/perl -- use strict; use warnings; use Cwd; use Win32::OLE; use XML::Simple; my $dir = cwd(); opendir(DIR, "."); my @file = grep(/\.xml$/,readdir(DIR)); closedir(DIR); use Data::Dumper; local $Data::Dumper::Indent=1; #print Dumper($doc); ################### #my %hash = ( # key1 => 'ArraySite', # key2 => 'IOPort', # key3 => 'AddressGroup', # key4 => 'LSS', # key5 => 'Array', # key6 => 'Rank', # key7 => 'ExtentPool', # key8 => 'Volume', # key9 => 'StorageEnclosure', # key10 => 'VolumeGroup', # ); # # for my $key ( keys %hash ) { # my $value = $hash{$key}; # print "$key => $value\n"; # } ############## my $xs1 = XML::Simple->new(); my $doc = $xs1->XMLin($file[0], keyattr=>[], ForceContent=>1, ForceArray=>1); for my $sub1 ( sort keys %{ $doc } ){ my $count = scalar keys %{ $doc }; print "\n$sub1\t"; for (my $i=0; $i <= $count; $i++) { for my $sub2 ( sort keys %{ $doc->{$sub1}[$i] } ){ my $count2 = @{$doc->{$sub1}[$i]{$sub2}}; #print "\n\t\t".$count2."\t".$sub2; for (my $j=0; $j <= $count2; $j++) { for my $sub3 ( sort keys %{ $doc->{$sub1}[$i]{$sub2}[$j] } ){ my $count3 = @{$doc->{$sub1}[$i]{$sub2}[$j]{$sub3}}; print "\n\t$sub2\t$sub3($count3)"; for (my $k=0; $k <= $count3; $k++) { print "\n"; for my $sub4 ( sort keys %{ $doc->{$sub1}[$i]{$sub2}[$j]{$sub3}[$k] } ){ print "\n\t\t\t$sub4 : "; print $doc->{$sub1}[$i]{$sub2}[$j]{$sub3}[$k]{$sub4}; } } } } } } }