> You might consider
> creating a config file that your script reads and builds the
> hash dynamically.
Agreed. And YAML is perfect for this kind of thing. Why?
- YAML is easily human-readable and editable (compared
to, say, XML)
- YAML can represent _any_ arbitrary Perl data structure.
There's no limit to the data you can put into YAML.
- YAML is really easy to use. See the example below.
--------- servers.yml ----------
PROD:
fullname: PRODUCTION
dbhost: proddb
dbsshcon: ''
version: 8.1.7
webhost1: prodapp
websshcon1: ''
DEV:
fullname: DEVELOPMENT
numweb: 1
version: 8.1.7
dbhost:
devdb:
sshcon: ''
webhost:
devapp:
sshcon: ''
--------- yourprog.pl ----------
Use YAML;
$inst = LoadFile('servers.yml');
#now $inst contains your data
--------------------------------
Note that your nested hashes are simply indented lines in the YAML file.
--
Mark Thomas
Internet Systems Architect
_______________________________________
BAE SYSTEMS Information Technology
2525 Network Place
Herndon, VA 20171 USA
_______________________________________________
Perl-Unix-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs