http://www.perlmonks.org?node_id=1055528

vitoco has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks!

I have a text file with a data structure, like this:

[{field1:value1,field2:value2,field3:value3} ,{field1:value4,field2:value5,field3:value6} ,{field1:value7,field2:value8,field3:value9} ]

There are no newlines (I put them to show records), and both field names and values may or may not be enclosed by quotes. Special chars in text values are escaped with backslash.

Is there a simple way to read this into a perl structure? I mean, an AoH...

EDIT: To clarify, as values can contain colons, commas and escaped quotes, I cannot write a simple regexpr. I guess I must parse it somehow, and I don't want to reinvent the wheel.