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
In reply to Re: Writing a hash of two variables to a file
by ikegami
in thread Writing a hash of two variables to a file
by Resin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |