guu has asked for the wisdom of the Perl Monks concerning the following question:
I got a file 'func_data' with a stored hash structure called FuncAssociateData
(but I don't know how the file was originally created :( ).
The first line of the file looks like:
pst0^D^D^D1234^D^D^D^H^Q^QFuncAssociateData^C^D^@^@^@^D^C{^\^@^@
and I can read the content of the file func_data using:
and than use the hash without problem.use Storable; %FuncAssociateData = %{ retrieve("func_data") };
If I read the file content with
I get$href = retrieve("func_data"); print "HREF: $href"
---
My problem starts, when I try to store the hash structure again in a file using:
use Storable; store(\%FuncAssociateData ,"new_func_data");
The file format looks similar, but not identical to the original file and the first line in this file looks like:
pst0^D^F^D1234^D^D^D^H^C^D^@^@^@^D^C{^\^@^@
Note that in contrast to the original file the name of the hash variable 'FuncAssociateData' is missing
and if I read the content with
it gives$href = retrieve("new_func_data"); print "HREF: $href"
How do I store a hash structure in a file, so that it is stored in the format as in the original file (including the name of the variable containing the hash) ???
e.g.
pst0^D^D^D1234^D^D^D^H^Q^QFuncAssociateData^C^D^@^@^@^D^C{^\^@^@
and NOT just
pst0^D^F^D1234^D^D^D^H^C^D^@^@^@^D^C{^\^@^@
The program using this data file works only with the first format, not with the second one.
Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Storing hash to disk with variable name
by Abigail-II (Bishop) on Feb 23, 2004 at 16:25 UTC | |
by guu (Initiate) on Feb 23, 2004 at 17:09 UTC | |
by Abigail-II (Bishop) on Feb 23, 2004 at 17:13 UTC | |
by guu (Initiate) on Feb 23, 2004 at 17:28 UTC | |
|
Re: Storing hash to disk with variable name
by davido (Cardinal) on Feb 23, 2004 at 17:18 UTC | |
|
Re: Storing hash to disk with variable name
by bean (Monk) on Feb 23, 2004 at 18:43 UTC |