SPUG: Dereferencing hash ref

Brose, Eric eric.brose at attws.com
Tue Aug 6 16:41:30 CDT 2002


Hello,

I'm using the XML::Simple module and need to recurse over my results.
----------------------------------------------------------------------------
-----
use XML::Simple;
use Data::Dumper;
 
my $ref = XMLin('C:\Perl\HBSource.xml');

print Dumper($ref);

foreach $setting (sort keys (%$ref)){
     #print "$setting\n";  This works!
	foreach $detail (sort keys %{$ref{$setting}} ){
		print "$ref{$setting}->{$detail}\n";
	}
}
;
---------------------------------------------------------------------

I'm trying to figure out how to review all of the info in the hash ref.  Can
someone give me some clues how i can change my foreach nested loops to get
our what I want.  Below is the kind of info i see in from datadumper.  I
need to be able to recurse through my data structure(the hash ref) to
extract this info. Any ideas?


$VAR1 = {
          'vtComponent' => {
                             'deployName' =>
'/FROG/InfoFlo/Connectors/HBSource',
                             'vtFlow' => {
                                           'vtProperty' => {
                                                             'channel' => {
 
'value' => 'CRM.INFOFLO.HB.SRC'
                                                                          },
                                                             'hostname' => {
 
'value' => 'googly
 
},
                                                             'QManager' => {
 
'value' => 'EGYPT'
 
},
 
'transactionQueue' => {
 
'value' => 'CRM.INFOFLO.HB.SOURCE.TRANQUEUE'
 
},
                                                             'QName' => {
 
'value' => 'ATCDEV3G3.HB.RECEIVE.QUEUE'
                                                                        }
                                                           },
                                           'name' => 'MQSeries Source'
                                         },
                             'componentType' => 'connector'
                           }
        };

Thanks,

Eric Brose




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/archives/spug-list/attachments/20020806/11eea275/attachment.htm


More information about the spug-list mailing list