good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Contextual find and replace large config fileby kschwab (Vicar) |
on Jan 02, 2019 at 18:34 UTC ( [id://1227939]=note: print w/replies, xml ) | Need Help?? |
"Does anyone know of a better or more generic way to do these kind of things?" There's lots of choices for config files. JSON and YAML are popular. Your second example is pretty close to JSON already. It would look like this as JSON:
There are perl modules to parse JSON, some streaming, if you really can't load it all into memory. There's also a really nice command line utility called "jq", see some examples here. Note that JSON doesn't support comments, which is probably the biggest complaint about it as a configuration file format.
In Section
Seekers of Perl Wisdom
|
|