Limo has asked for the wisdom of the Perl Monks concerning the following question:

Here's a snippet of the config file:


system {
     host steve-1;
     domain-search  myhost.com myhost.net ;
     time/zone Here/There;
     auth-order  my password ;
     root-auth {
#          enc-pwd "NOWAY"; #YOU CANT HAVE THIS
     }

server {
     1.2.3.4;
     5.6.7.8;
}

What I'd like the above to convert to flat file:


system:
     Host: steve-1
     Domain-search:  myhost.com myhost.net
     Time Zone: Here/There
     Auth-Order: my password 
     Root-Auth: enc-pwd = "NOWAY" #YOU CANT HAVE THIS

system > name-server: 1.2.3.4 5.6.7.8

I'm a little over my head, but if someone could point me in the right direction, I would be very grateful.
  • Comment on How to creat a flat file from config. file?

Replies are listed 'Best First'.
Re: How to creat a flat file from config. file?
by davorg (Chancellor) on Aug 24, 2000 at 20:26 UTC
(jeffa) Re: How to creat a flat file from config. file?
by jeffa (Bishop) on Aug 24, 2000 at 20:34 UTC
    Man, this looks just like XML - you should consider using XML::Parser if you don't feel like coding a lot of nasty regex code. It also might be a little easier then Parse::RecDescent.

    Jeff