My fellow Monks have all gone lyrical over the benefits of the use of DBI and databases (and very right they are: if you are going to use a database, DBI is
the way to go and then you better at the same time install a real database engine, such as
MySQL) but I fear that is perhaps not what you were asking: i.e.
use SQL statements to traverse a set of hashes.
If by hashes you mean the associative arrays of Perl, I don't think that you can traverse them by using SQL, or at least not in an easy and straightforward way.
DBI::AnyData can use an Array of Arrays (in a particular format) as a data source and theoretically a Hash of Arrays is perhaps just as possible, but it is not documented.
My advice to someone new to (Perl) programming is not to mix hashes and SQL, but rather to concentrate on getting a good grip first on each of these separately.
If you will spend some more time in the Monastery, you will see that we are much better in providing practical answers to concrete questions than in discussing issues of a more general nature (where we tend to become rather filosophical). So if you provide us with some examples of your data, your data structure and perhaps some code snippets, we will gladly give you a "made to measure" solution.
CountZero
"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.