I'm using the Storable module to save and load a hash tree. I also
want to use the
Hash::Case::Lower module to make my hash case insensitive. I can't
figure out how to tie a
hashref to the Hash::Case::Lower module and load data into it with
Storable. I tried
something like:
use Hash::Case::Lower; use Storable;
tie my(%realhash), 'Hash::Case::Lower'; my $hashref = \%realhash; $hashref = retrieve('somefile');
This causes $hashref to be assigned to the anonymous hash returned
from retrieve() so that
it no longer points to the tied hash. It is then no longer case
insensitive. How can I
make this work?
You need to tie your hash after retrieving the values. Or provide the values as part of the tie invocation. I haven't worked with Hash::Case before, but it looks from the docs that you can provide your retrieved hashref as the 'VALUES'. For instance,
my $thawed = retrieve('somefile'); tie my(%realhash), 'Hash::Case::Lower', $thawed;
Ah, I guess I'd missed that part in the docs for the Hash::Case::Lower module. Is it safe to 'delete $thawed' after I tie the hash so I don't have an extra copy of the hash floating around?
-- Andrew Gaffney Network Administrator Skyline Aeronautics, LLC. 636-357-1548
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>