in reply to Parsing deep XML

The error message is exactly what the problem is--you are trying to use the reference in $ref->{ICD_Description} as an array, when it's actually a hash. You can't use your foreach loop to traverse through the data in the way you are trying.

In other words, $ref is a hashref, and $ref->{ICD_Description} is also a hashref, but you're trying to use it like it's an array ref. The output from Dumper is the key to seeing what kind of data are in the variable. If a section starts with a {, it is a hashref; if it starts with a [ it is an array ref. It also looks like StructureType points to an array ref, which then has a list of hashrefs.

You should be able to access the array of StructureTypes with something similar to the following (untested):

foreach my $structure_type (@{$ref{ICD_Description}{MsgData}{MsgDataRe +gion}{Msg_Data}{Array}{StructureType}}) { print "$structure_type{DataLine}{DataField}\n"; }