in reply to How to analyse structured data to get a hash

Something else that immediately occurs to me:   “is this XML?”

For instance, if the data actually looked like:

<Attr num="101" name="Created" desc="Time file was created." type="t" ord="3" value="2017-06-03T11:27:23+01:00"></Attr>
... then it would be in a very well-known data format (XML) that is well-supported by Perl and most other languages.   So, take a moment to be sure that you are not actually, in fact, dealing with a problem that has not already been well-solved before.   “Structured data” is very often expressed in XML because this format allows for the easy expression of nested data structures.

Replies are listed 'Best First'.
Re^2: How to analyse structured data to get a hash
by jdporter (Paladin) on Jun 09, 2017 at 15:33 UTC

    And even if it isn't XML, you could jam it into XML in order to take advantage of existing XML parsing facilities. To wit:

    use XML::Simple; while (<>) { chomp; my $hashref = XMLin("<$_/>"); ... }