in reply to Writing a hash of two variables to a file
In what format do you want your file to be?
If the file doesn't have to be user-readable, I'd use Storable
JSON provides a portable format that's rather user-readable but not very user-modifyable.
There's also YAML and XML::Simple.
Data::Dumper can be used to dump a structure as Perl code, so you can simple use do or eval, but that allows arbitrary execution of Perl code. I recommend against this.
All of the above support the storage of complex structures. However, that makes them harder for users to edit them manually. A lot of modules on CPAN provide the facilities to read and write a variety of user-modifyable formats, but I don't have any to recommend.
Why invent yet another format. There are plenty from which to choose already.
Updated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing a hash of two variables to a file
by Resin (Novice) on Oct 25, 2006 at 03:20 UTC |