P is for Practical | |
PerlMonks |
Re: Parsing bracket formatted fileby LanX (Saint) |
on Sep 24, 2022 at 10:49 UTC ( [id://11147104]=note: print w/replies, xml ) | Need Help?? |
I have to second what hv already said, this description > The overall record is enclosed with brackets and is composed of KEY, VALUE pairs. doesn't fit the demonstrated sample. There are more types like LIST and QUOTED-STRINGS and especially the first "KEY" (?) sys ecm cloud-provider /Common/aws-ec2 is very confusing. You should better provide an SSCCE (update: especially the expected output) > Any advice on the best way to approach it would be greatly appreciated! Regarding recursive structures > the VALUE, which can be simple text or another bracketed sub-record. you might want to have a look at EDITFWIW: I think after tr/-/_/ I could parse this as a non-strict Perl DSL, just by predefining the key-words as subs. But w/o better specification (whats a keyword, what a bareword/string) of the desired outcome, there is no point in attempting it. Cheers Rolf
In Section
Seekers of Perl Wisdom
|
|