> On Thu, Mar 12, 2009 at 09:20, Jerry Rocteur <mac...@rocteur.cc> wrote: >> Hi, >> >> I'm trying to tie this kind of hash into SDBM >> >> $hash_of_baseline{$hdr_user_name} = { user_name => $hdr_user_name, >> passwd => $hdr_user_passwd, >> ... >> ... >> groups => [ @info_group_names ] }; >> >> I can store it but when I read it back I get. >> >> Can't use string ("HASH(0x1db393b0)") as a HASH ref while "strict refs" in >> use at >> >> I think I understand from what I've googled that I can't use SDBM for this >> kind of structure. >> >> I searched around and found MLDBM. >> >> I'm looking for advice, is this the best solution or am I on the wrong track >> ? > snip > > DBM files can only store simple values like strings and numbers. You > are trying to store a complex data structure in one. The general > method of solving this problem is to use the Storable module* to > serialize the data structure as a string before storing it in the DBM, > or to use a module like DBM::Deep** that automates this for you. > [...] > [...] > > print Dumper \%deep, \%new; > > * http://perldoc.perl.org/Storable.html > ** http://search.cpan.org/dist/DBM-Deep/lib/DBM/Deep.pod
Thanks very much Chas. I really appreciate this. I am glad I asked the question to the list. I will look into the easiest solution, I don't like having to integrate a new module into the system build unless absolutely necessary so I will study it carefully. My idea of storing into DBM was to speed up initial access to the data! Have a GREAT weekend, Jerry -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/