in reply to Use of Hash For Table Lookup
If you build one of the scripts as a module, you can just pass the hash natively in perl.
If you don't want to do that, you can use a serialization format, such as Data::Dumper, Storable, YAML or XML. And many others ;-)
(Update:) If you want to stick to your current solution (and reinvent the Data::Dumper wheel), you can read the file and eval it.
But I wouldn't recommend that because for example it breaks if some of your data contain quotes.
Suppose a malicious user knows how your code works, and inserts something like this into your logfile:
someApp'}; system("Do something malicious here");{'
If you eval() that, you lost.
I don't know what data will end up in your logfile, but if you use a module that does the job for you, you are probably not so vulnerable.
|
|---|