in reply to perl and sql

I kinda hate to answer this because as others have pointed out DBI/DBD are really the way to go; however, that being said, most databases provide a program to query the database. You should be able to do something like this:

mysql < text_file_containing_sql

I'll leave it up to you to figure out how to put the sql on the command line instead of a file and also how to execute a shell command from perl. My suggestion is to get the command correct from the command line and then move that into your script.

-derby