travisbickle34 has asked for the wisdom of the Perl Monks concerning the following question:
Basically I'm attaempting to store some complex perl data structures in a DBM hash flatfile database using the DBM::Deep module from CPAN.
A simplified version of the problem is this. Imagine a script:
#!/usr/bin/perl use strict; use warnings; use DBM::Deep; my $db = new DBM::Deep "db.file"; $db->{hash}->{key}->[0] = 10; print $db->{hash}->{key}->[0]; exit;
Basically, the first time the script runs, the db file is created but the variable isn't printed. It has to be run a second time before the value is allocated to the variable and the print occurs. After the second run it works fine. This may not seem like a problem in the above script but it is a serious problem in the actual script I'm trying to implement which is using incrementing counts and autovivification.
Any suggestions?
Cheers in advance,
tb34
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBM::Deep Problem
by holli (Abbot) on May 18, 2005 at 08:40 UTC | |
by travisbickle34 (Beadle) on May 18, 2005 at 08:46 UTC | |
by holli (Abbot) on May 18, 2005 at 08:53 UTC | |
by merlyn (Sage) on May 18, 2005 at 12:27 UTC | |
by travisbickle34 (Beadle) on May 18, 2005 at 08:58 UTC | |
|
Re: DBM::Deep Problem
by astroboy (Chaplain) on May 18, 2005 at 10:22 UTC | |
by travisbickle34 (Beadle) on May 18, 2005 at 10:29 UTC | |
by demerphq (Chancellor) on May 18, 2005 at 11:18 UTC | |
by tye (Sage) on May 19, 2005 at 06:15 UTC | |
by travisbickle34 (Beadle) on May 18, 2005 at 11:42 UTC | |
by demerphq (Chancellor) on May 18, 2005 at 12:19 UTC | |
| |
by astroboy (Chaplain) on May 18, 2005 at 10:34 UTC | |
|
Re: DBM::Deep Problem
by thcsoft (Monk) on May 18, 2005 at 08:24 UTC | |
by travisbickle34 (Beadle) on May 18, 2005 at 08:39 UTC |