I have a script that uses a hash that contains four lines as keys whose values โโare hashes. These hashes also contain four lines as keys, which also have hashes as their values. This pattern continues to levels n-1, which is determined at run time. The n-th level of hashes contains integer (unlike regular hash links) values.
I installed the BerkeleyDB module for Perl, so I can use disk space instead of RAM to store this hash. I suggested that I could just attach the hash to the database, and that would work, so I added the following to my code:
my %tags = () ; my $file = "db_tags.db" ; unlink $file; tie %tags, "BerkeleyDB::Hash", -Filename => $file, -Flags => DB_CREATE or die "Cannot open $file\n" ;
However, I get an error message:
It is not possible to use the string ("HASH (0x1a69ad8)") as a HASH ref, and "strict refs" is used in the string getUniqSubTreeBDB.pl 31, line 1.
To test, I created a new script with the code (above) associated with the file hash. Then I added the following:
my $href = \%tags; $tags{'C'} = {} ;
And everything went perfectly. Then I added:
$tags{'C'}->{'G'} = {} ;
And it will give almost the same error. I think BerkeleyDB cannot handle the type of data structure that I create. Maybe he was able to handle the first level (C โ {}) in my test, because it was a regular regular key โ scaler?
In any case, any suggestions or statements of my hypothesis will be appreciated.
gravitas
source share