On Fri, 1 Jun 2001 [EMAIL PROTECTED] wrote:

> OK first of all, I'm a total perl newbie. I've been programming in VB for a
> couple years, but I'm "gradutating" into perl. May god have mercy on us all.

Congratulations.  Once you start working with Perl, VB will seem extremely
chidlish. :-)

> My question is more conceptual:
> I have two comma delimited text files, that are essentially database tables.
> One is materials, one is orders.
> They link via material field in a one to many relationship. (Material)
>
> My goal is to have all pertinent information from these tables linked and
> loaded as demand into an array/hash (I'm new, but it's looking like it will
> be a hash) and then additional manipulations/comparisons will be done with a
> third file.
>
> The two tables lend themselves very naturally to a SQL statement.
> Does PERL support SQL without a specific database/driver installed? I've
> scanned through the DBI in CPAN but I couldn't find an answer. (Again, I'm a
> newbie)

There is a very nice DBI driver called DBD::CSV which will let you
manipulate comma-separated (or other character-separated) files with SQL.
I use this all the time when I get comma-separated files and want to load
them into, say, PostgreSQL or MySQL and want to do some processing on the
data before it gets loaded.  I also use it to dump PostgreSQL data so I
can run it through a mail merge with MS-Word on a Mac.

You will need to load DBD first, of course, which you can get from CPAN.
I think DBD::CSV might even be packaged with DBI by default.

> If not, what is an optimal approach to this problem?
> My first hunch would be to loop through the demand file one record at a
> time, link the data from the materials file, and load into a hash. Both
> files will have approximately 6000 records. (+/- 2000)

No need to reinvent the wheel.  I'd use DBD::CSV.  DBI is something worth
learning anyway.

-- Brett

Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]

Reply via email to