use strict; use XML::Simple; use Data::Dumper; my $config = XMLin('config.xml'); print Dumper($config); for my $record (@{my $VAR1->{Application}}) { my $environment = $record->{Environment}->{Name}; my $region = $record->{Environment}->{Region}->{Name}; my $Idrive = $record->{Environment}->{Region}->{Idrive}; my $Zdrive = $record->{Environment}->{Region}->{Zdrive}; print "$environment"; print "$region"; print "$Idrive"; print "$Zdrive"; } #### $VAR1 = { 'Application' => { 'Environment' => [ { 'Region' => [ { 'Zdrive' => '\\\\otherpath', 'Idrive' => '\\\\somepath', 'Name' => 'LN' }, { 'Zdrive' => '\\\\otherpath', 'Idrive' => '\\\\somepath', 'Name' => 'NY' } ], 'Name' => 'A' }, { 'Region' => [ { 'Zdrive' => '\\\\otherpath', 'Idrive' => '\\\\somepath', 'Name' => 'LN' }, { 'Zdrive' => 'otherpath', 'Idrive' => '\\\\somepath', 'Name' => 'NY' } ], 'Name' => 'B' } ], 'Name' => 'App1' } };