in reply to Re: Re: Re: Database storage confusion
in thread Database storage confusion

I suppose but I find it easier to write $_ = <STDIN> then assign a variable to hold $_, makes it easier for me to understand or see I guess.

I already knew how to assign a value to the database key such as your phone number, the thing I'm trying to do is assign more than one value. Ie. I want $number, $address, $city, $emailaddress all stored under $name and have each of them retrievable. I'm reading up on MLDBM since some people yesterday said that would do the trick.

Thanks for your help!

"Age is nothing more than an inaccurate number bestowed upon us at birth as just another means for others to judge and classify us"

sulfericacid
  • Comment on Re: Re: Re: Re: Database storage confusion

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Database storage confusion
by demerphq (Chancellor) on Mar 10, 2003 at 08:15 UTC

    MLDBM does something like a more sophisticated

    # Store $dbm{$name}=join "\0",$number,$address,$citty,$emailaddress; # Fetch my ($number,$address,$citty,$emailaddress)=split /\0/,$dbm{$name};

    Which would perfectly suitable for your limited requirements. (Well, it assumes that there are no \0 in the input data. A safe bet in this situation I think, and easily enforced) But certainly do look into using the module, although for something this simple I wouldnt bother with MLDBM at all. Now if you want to store a sophisticated data structure like a tree or something, then MLDBM gets pulled off the shelf.


    ---
    demerphq