in reply to Re: DBM
in thread DBM

No not storable i want to create something of the type $hash{$value1}{$value2}->[0]1;

Replies are listed 'Best First'.
Re: Re: Re: DBM
by rdfield (Priest) on Nov 01, 2002 at 09:58 UTC
    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

      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