You're making this much harder than it needs to be. If no one needs to edit the file by hand, just use Storable. It has built-in functions for saving and loading a hash from a file, and you can nest data structures inside it if you need to.
If people need to be able to vi the file, use Andy Wardley's nice AppConfig module. It can merge in overrides from the command line, handle site-wide configs, etc.