You might want to try some persistence modules, e.g.
. These will allow you to serialize a perl data structure to a string, which can be written to a file, and read it back in later and deserialize it back to the structure. You can then use an external file, which is safer as you can't accidentally overwrite pieces of your script. Also, the modules will allow for if you must store more complex structures later, whereas simply flat-filing it will not.