in reply to Re: Re: DBM
in thread DBM

Have you read the MLDBM documentation? It is very clear on the prerequisites and there is a fine example included, which can easily be adapted to your purposes. Perhaps you should post your current code and we can let you know where you're going wrong.

BTW, you might also want to have a look at Writeup Formatting Tips.

rdfield

Replies are listed 'Best First'.
Re: Re: Re: Re: DBM
by Anonymous Monk on Nov 01, 2002 at 10:48 UTC
    if ($male) { $hash{$nameplace}{$person}->[0]++; } else { $hash{$nameplace}{$person}->[1]++; }
    This is my present code
    What i wanted to do is put this in to MLDBM.
    The thing is, every place contains a
    hash of people.
    ie there are various persons for each name
    place.
    so i am not able to do it.
    so if u cld be able to help me
      From the docs:

      Declaring an MLDBM hash:

      use MLDBM; use Fcntl; $dbm = tie %o, 'MLDBM', 'testmldbm', O_CREAT|O_RDWR, 0640 or die $!;
      and modifying an item:
      $tmp = $mldb{key}; # retrieve value $tmp->{subkey}[3] = 'stuff'; $mldb{key} = $tmp;
      which in your case would be something like:
      use MLDBM; use Fcntl; $hash = tie %o, 'MLDBM', 'testmldbm', O_CREAT|O_RDWR, 0640 or die $!; ... $tmp = $hash{$nameplace}; if ($male) { $tmp->{$person}[0]++; } else { $tmp->{$person}[1]++; } $hash{$nameplace} = $tmp;
      (note this is untested...)

      rdfield