There must be some way to have the set of tabular data not each be their own separate files.
The .lck file is created by DBD::DBM, if you don't need locking, you can turn locking off and that file won't be created. The other two files are created by your underlying DBM implemnetation, some of those create only a single file per table and some create two files per table, that's how DBM works.
If I have 100 tables, I can't handle 300 files in one directory just for the database to work.
What's wrong with 300 files? The whole point of a database is that you shouldn't need to worry about how it physically stores the data so the fact that there are multiple files is really irrelevant. You will be using SQL to CREATE and DROP tables, the fact that creating and dropping happens to create multiple files, doesn't really impact the basic SQL operations. You will never actually handle the files as files, only as SQL tables, the same way you would any SQL table. But, in any case, if that bothers you, use DBD::SQLite which stores all tables for a given database in a single file.
Second question is seems more of an SQL question but when you SELECT something from the table such as: SELECT phone FROM user WHERE user_name < 'Fred'; To store the results, you could use: my $var = SELECT phone FROM user WHERE user_name < 'Fred';
Well, that's actually a DBI question. You can put the reuslts of a query in a variable with DBI's $dbh->selectrow_array, $dbh->selectall_arrayref, etc. or prepare and execute a statement handle and use a loop with $sth->fetch or $sth->fetchrow_harshref, etc.

While I agree with the other posters that for most production work (but by no means all), a full RDBMS like PostgreSQL or MySQL is better than DBD::DBM, but since you appear to be in the early learning stages, DBD::DBM should work fine for you - you can learn basic SQL and DBI with it just fine.

disclaimer I'm the author of DBD::DBM so I'm prejudiced. OTOH, the reason it is included in the DBI distribution is because it is sufficient for learning the basics of DBI access to databases.


In reply to Re: DBD::DBM file creation by jZed
in thread DBD::DBM file creation 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.