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.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Move data into AoH
by LanX (Saint) on Sep 24, 2013 at 21:07 UTC | |
Re: Move data into AoH
by hdb (Monsignor) on Sep 25, 2013 at 06:24 UTC | |
Re: Move data into AoH
by VinsWorldcom (Prior) on Sep 24, 2013 at 21:05 UTC | |
Re: Move data into AoH
by ww (Archbishop) on Sep 24, 2013 at 19:41 UTC | |
by vitoco (Hermit) on Sep 24, 2013 at 19:49 UTC | |
by vitoco (Hermit) on Sep 24, 2013 at 20:36 UTC | |
Re: Move data into AoH
by ww (Archbishop) on Sep 25, 2013 at 17:00 UTC | |
by vitoco (Hermit) on Sep 26, 2013 at 13:39 UTC | |
by ww (Archbishop) on Sep 26, 2013 at 19:13 UTC | |
by vitoco (Hermit) on Sep 26, 2013 at 22:18 UTC | |
Re: Move data into AoH
by vitoco (Hermit) on Sep 25, 2013 at 14:02 UTC |
Back to
Seekers of Perl Wisdom