Re: file parsers



On Fri, 3 Jun 2005, lance w wrote:

> I have a ms access db that spits out all the zip codes of our
> subscribers. I'd like to write a program that can parse, group, and
> count like numbers, eventually for relay to a graphic interface. Being
> new to perl, where is a good place to start?

Try DBI and DBD::ODBC.

Most database programming in Perl is done with the DBI (database
interface) CPAN module, and a DBD (database driver) for the database
engine you're working with. In that way, the same program code can be
applied to different databases with few if any changes -- in general,
you may need to rewrite some SQL statements, but that's about it. You
can read about DBI on cpan.org at this page:

<http://search.cpan.org/~timb/DBI/DBI.pm>

On Windows, most database programming goes through the ODBC bridge,
which is more or less exactly what DBI provides for Perl. Therefore, the
easiest way to get Perl code working with most databases on Windows is
to use the ODBC driver, DBD::ODBC. Read about it here:

<http://search.cpan.org/dist/DBD-ODBC/ODBC.pm>

The standard book for this is _Programming the Perl DBI_:

<http://www.oreilly.com/catalog/perldbi/>

There's a sample chapter online explaining the general architecture of
DBI and how to work with it in your programs:

<http://www.oreilly.com/catalog/perldbi/chapter/ch04.html>

Take a look over this material, try writing some basic scripts with it,
then come back to the list when you have more specific questions.




--
Chris Devers
.



Relevant Pages

  • Re: How to access MS Access from Perl?
    ... if you were to later migrate to MS SQL Server or Oracle ... minimize your load on the database server's compiled procedure cache. ... On the other hand, if startup time for your perl script is an issue, and ... slightly preferable to the bulkier DBI + DBD::ODBC. ...
    (comp.lang.perl)
  • Re: DBD::Informix and SIGBUS in perl
    ... use DBI; ... > My program is a CGI script in perl, which provides web-access to a database ... assigned to a DBD::Informix database handle. ... > LANGUAGE (unset) ...
    (perl.dbi.users)
  • ANNOUNCE : DBIx::DataModel
    ... This is to announce yet another wrapper module on top of DBI, ... Please have a look and see whether it can help suit your needs. ... base DBI layer and to the basic Perl datastructures, ... will not create the database itself. ...
    (perl.dbi.users)
  • Re: Any good Perl coders out there?
    ... I need to convert a PHP script into Perl. ... do is check out the DBI and DBD modules at your friendly neighborhood CPAN ... DBD is the actual database driver for it. ...
    (comp.lang.perl.misc)
  • Re: Theres got to be a better way
    ... I work with annoyingly complex database tables whose structure ... Programming is all about reinventing the wheel. ... But we're still writing code must like we did 40 years ago. ...
    (comp.lang.php)

Loading