Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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: (6)
As of 2024-03-29 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found