in reply to using databases
Take a look at this article: A Short Guide to DBI.
This article is very brief, but is Postgres specific.