I do not have any real history of using databases and I don't have any books on them. Don't suggest me to read books since I don't have the funds to get any more :( And please don't down vote this because you think it's easy or something everyone should know because guess what, I don't.

Basically all I know from databases are from example scripts I see every once in a while and I know how to store variables. That's about the extent of my knowledge.

I'm using SDBM and have run into a weird situation. I'm asking for a user's name and storing that into the DBM. All I want is one name to be stored into the database for each person. What's weird about this?

$dbm{'name'} = $name overwrites the previes entry
$dbm{$name'} = $name creates redundant Aaron Aaron
$dbm{$name}; creates Useless use of DBM error
$dbm{$name} = ""; writes Aaron

My question is, why would you need to assign a null value to $name instead of just $dbm{$nam}; ? There has to be some kind of logic because it's more writing this way and this situation must have occured with other people. You don't always need a value, what happens if all you want is a key?

As far as I can tell there is logic to only want a key sometimes, this doesn't make any sense.

Also, I am looking to store more than one variable into a database under a specific key. What would be the easiest database to use to do this? Someone already suggest MLDBM, I was just wondering if anyone else had suggestions.

IE. $name: $address|$email|$phone

Thanks for all your help everyone.



"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


In reply to Database storage confusion by sulfericacid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.