|Perl: the Markov chain saw|
XML to Hash Truncating Keys Problemby Wayne (Novice)
|on Mar 28, 2019 at 14:21 UTC||Need Help??|
Wayne has asked for the wisdom of the Perl Monks concerning the following question:
I am attempting to parse valid XML data as a string and output the result as a complex data structure (a hash of hashes and arrays) which I can then use to reference individual data elements.
I have written a small function to perform this task, which almost works. It runs without error and it does return a hash that I can reference.
The problem is that a few of the hash keys have been truncated. That is, they are missing the last character. The majority of keys, however appear fine.
I am using valid XML and the problem appears to be intermittent, although the fields affected are always the same (company_name, fee_lines, address_2, etc.)
Here is the code i'm using:
Here is a sample of the output:
At first I thought that they were just some careless typos, but after some investigation I realized that was not the case.
Any insight into this problem or a nudge in the right direction would be greatly appreciated.