You may want to take a look at
Perl for System Administration by O'Reilly and Associates. Chapter 5 (TCP/IP Name Services) pages 149-167 describe generating BIND config files from a db. You can make all your changes to the db (through CGI if you like) and then dump the config files from the db. This way, there is no need to parse the existing files because the data is stored in the db.
I highly recommend taking a look at this chapter. Even though the example is rather simplistic and wouldn't suit the needs where I work, it could be easily modified to incorporate the changes we need. We are looking into moving in this direction in the future.
perl -e 'print reverse qw/o b n a e s/;'