I am using DBM::Deep for the reason it support multilevel hashes, however I
ended up in situation where I am getting error while retrieving values from
keys :-

Can't use string ("test1") as a HASH ref while "strict refs"

use Parallel::ForkManager;
use DBM::Deep;
       my $db = new DBM::Deep(
             file => "userdata.db",
             locking => 1,
             autoflush => 1
        );

passed this ref to a subroutine...

where I input the values as :-

            $entry->{'name'} = $name;
            $entry->{'id'} = $id;
            $users->{'pending'}->{$entry->{'name'}}->{'email'}=$name;
            $users->{'pending'}->{$entry->{'name'}}->{'id'}=$id;
             return $users;

and in other routine I get values :

foreach my $acct (keys %{$users->{pending}}) {
    print $acct->{id};
}

However I get error saying :-

Can't use string ("user1") as a HASH ref while "strict refs" in use

The Dumper o/p of $db is :-

$VAR1 = bless( {
                 'pending' => bless( {
                                       'user1' => bless( {

'email' => 'us...@test.com',

'id' => '123'
                                                                       },
'DBM::Deep::Hash' ),
                                       'user2' => bless( {

'email' => 'us...@test.com',

'id' => '343'

}, 'DBM::Deep::Hash' ),
                                       'user3' => bless( {

'email' => 'us...@test.com',

'id' => '443'

}, 'DBM::Deep::Hash' ),
                                                                      },
'DBM::Deep::Hash' )
                                     }, 'DBM::Deep::Hash' ),
               }, 'DBM::Deep::Hash' );

Is there something I am  doing wrong ?

Thanks and Regards.

Reply via email to