Smaug has asked for the wisdom of the Perl Monks concerning the following question:
$VAR1 = { 'Product' => { 'Unicenter CA-Deliver Output Management' => { 've +ndorUniqueKeyRef' => 'CA', 'sw +UniqueKey' => 'RMO', 'de +scription' => 'Unicenter CA-Deliver Output Management' }, 'Unicenter CA-JCLCheck Utility' => { 'vendorUniqu +eKeyRef' => 'CA', 'swUniqueKey +' => 'JCLCHECK', 'description +' => 'Unicenter CA-JCLCheck Utility' }, 'EREP Environmental Recording Edit Print' => { 'v +endorUniqueKeyRef' => 'IBM', 's +wUniqueKey' => 'EREP', 'P +roductVersion' => { + 'version' => '3', + 'swUniqueKey' => '5658-260', + 'name' => 'EREP Environmental Recording Edit Print' +, + 'versionNumber' => '03' + }, 'd +escription' => 'EREP Environmental Recording Edit Print' }, 'SYSQL' => { 'vendorUniqueKeyRef' => 'SPLWDGRP', 'swUniqueKey' => 'SYSQL', 'ProductVersion' => { 'ProductVersionR +elease' => { + 'releaseNumber' => '01', + 'swUniqueKey' => 'SYSQL-21', + 'name' => 'SYSQL', + 'release' => '1' + }, 'version' => '2' +, 'swUniqueKey' => + 'SYSQL-2', 'name' => 'SYSQL +', 'versionNumber' +=> '02' }, 'description' => 'SYSQL' }, '3270-PC File Transfer Program' => { 'vendorUniqu +eKeyRef' => 'IBM', 'swUniqueKey +' => '3270PCFT', 'description +' => '3270-PC File Transfer Program' }, 'Tivoli OMEGAMON XE on z/OS' => { 'vendorUniqueKe +yRef' => 'IBM', 'swUniqueKey' = +> 'OMXEZO', 'ProductVersion +' => { + 'version' => '3', + 'swUniqueKey' => '5698-A59', + 'name' => 'Tivoli OMEGAMON XE on z/OS', + 'versionNumber' => '03' + }, 'description' = +> 'Tivoli OMEGAMON XE on z/OS' }, 'Tivoli OMEGAMON XE for Messaging for z/OS' => +{ +'vendorUniqueKeyRef' => 'IBM', +'swUniqueKey' => 'OMXEMES', +'description' => 'Tivoli OMEGAMON XE for Messaging for z/OS' }, 'DB2 Utilities Suite for z/OS' => { 'vendorUnique +KeyRef' => 'IBM', 'swUniqueKey' + => 'DB2UTSU', 'ProductVersi +on' => { + 'DB2 Utilities Suite for z/OS' => { + 'swUniqueKey' => '5655-N97', + 'version' => '9', + 'versionNumber' => '09' + }, + 'DB2 Utilities Suite' => { + 'swUniqueKey' => '5697-E98', + 'version' => '7', + 'versionNumber' => '07' + } + }, 'description' + => 'DB2 Utilities Suite for z/OS' }, 'UMB' => { 'vendorUniqueKeyRef' => 'CSC', 'swUniqueKey' => 'CSCUMB', 'description' => 'UMB' } } };
my $sw = $xmldoc->{'Catalog'}->{'Products'}; my %sw = %{ $sw->{'Product'}}; foreach my $product (keys %sw) { print "Now processing $product\n"; my $version; my $release; my $description = $sw{$product}{'description'}; my $vendorUniqueKeyRef = $sw{$product}{'vendorUniqueKeyRef'}; my $swUniqueKey = $sw{$product}{'swUniqueKey'}; if ($sw{$product}{'ProductVersion'}) { $version = $sw{$product}{'ProductVersion'}{'version'}; if ($sw{$product}{'ProductVersion'}{'ProductVersionRelease'}) +{ $release = $sw{$product}{'ProductVersion'}{'ProductVersion +Release'}{'release'}; } else { $release = 0; } } else { $version = 0; $release = 0; } my $fullVersion = "$version.$release"; print " ***************\n The product is: $product\n The description is: $description\n The vendorUniqueKeyRef is: $vendorUniqueKeyRef\n The ProductVersion is: $fullVersion\n The swUniqueKey is: $swUniqueKey\n ***************\n"; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Iterative HOH or AOH?
by hbm (Hermit) on Aug 06, 2012 at 19:18 UTC | |
|
Re: Iterative HOH or AOH?
by ig (Vicar) on Aug 07, 2012 at 07:24 UTC | |
|
Re: Iterative HOH or AOH?
by choroba (Cardinal) on Aug 06, 2012 at 20:01 UTC |