Perl: the Markov chain saw | |
PerlMonks |
Re: Parsing an Arbitrary "config" file (based on a "template"?)by roboticus (Chancellor) |
on Dec 31, 2014 at 22:22 UTC ( [id://1111870]=note: print w/replies, xml ) | Need Help?? |
If it's always that format, you don't need anything fancy. Just read the file, split each line into two chunks at the first colon, and package it all up into a hash. It should be something like this:
(Note: untested...) Update: I actually like Marpa::R2 a good bit. I just did a project at work with it last month where I had to write a parser for a programming language. I found it to be pretty nice to use in that capacity. But it's overpowered, in my opinion, if you have simple tag:value pairs in a configuration file. ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|