in reply to Need help connecting to MySQL from .pl

Wow, I hardly know where to start ...

Perhaps you could begin by putting your code in <code> ... </code> tags. It looks much more nicely.

Next, you use strict; which is good, but then none of your variables are declared with my so your code will not even run. Did you try this code at home on your own computer before uploading it? If you did you would have seen it didn't work.

You execute the SQL through a $connect object variable but your never define it anywhere.

I would suggest you start with something a bit less difficult, learn about the basics of Perl and study the DBI-module.

I have also the feeling your connect call is wrong. The syntax is $dbh = DBI->connect($data_source, $username, $password) or die $DBI::errstr; and $data_source should be in the dbi:DriverName:database_name format/

More specifically for MySQL it should be:

my $dsn = "DBI:mysql:database=$database;host=$hostname;port=$port"; my $dbh = DBI->connect($dsn, $user, $password);

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James