I am sending this hash reference $packagehash to a function which generates my desired xml file. I call the function as$packagehash = { ' IBM Tivoli Runtime Security Services Client ' => { 'Publis +her' => 'IBM', 'Versio +n' => ' 7.1.0.2 ', 'Produc +tCode' => ' com.ibm.rtss.client', 'Produc +tName' => ' IBM Tivoli Runtime Security Services Client ' }, ' IBM Tivoli Runtime Security Services Software Development +Kit ' => { + 'Publisher' => 'IBM', + 'Version' => ' 7.1.0.2 ', + 'ProductCode' => ' com.ibm.rtss.sdk', + 'ProductName' => ' IBM Tivoli Runtime Security Services So +ftware Development Kit ' + }, ' IBM Tivoli Runtime Security Services Server ' => { 'Publis +her' => 'IBM', 'Versio +n' => ' 7.1.0.2 ', 'Produc +tCode' => ' com.ibm.rtss.server', 'Produc +tName' => ' IBM Tivoli Runtime Security Services Server ' } };
My logic in the function to retrieve inner hash key values i.e 'ProductName','ProductCode','Version' and 'Publisher' is not working.Output is blank. Here is the code i wrote:&getxml($packagehash);
When i print just $key, it prints outer hash keys,which is correct i.e productnames.But,if i want to extract their corresponding inner hash key and values,Output is showing blank.Please help me where i am making mistake.sub getxml($) { my $hashref = shift; foreach my $key ( keys %${hashref} ){ print $key->{'ProductName'} print $key->{'ProductCode'} print $key->{'Publisher'} ...xml logic... }
In reply to Converting HOH to a XML not working by sriram83.life
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |