Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Parsing bracket formatted file

by LanX (Saint)
on Sep 24, 2022 at 10:49 UTC ( [id://11147104]=note: print w/replies, xml ) Need Help??


in reply to Parsing bracket formatted file

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

EDIT

FWIW: 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
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147104]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2025-07-14 15:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.