Problem with executing FirtPerlScript.pl

Problem with executing FirtPerlScript.pl

am 20.09.2002 01:37:39 von j zhao

--0-1861339067-1032478659=:71794
Content-Type: text/plain; charset=us-ascii


Hi,

I couldn't execute successfully the perl DBI/DBD example "FirstPerlScript.pl" (attached below) downloaded from MySQL CD-ROM code subdirectory. Did anyone have the experience and figure it out?

The source file and error message are follows. Any responses would be greatly appreciated. Thanks, Jinhua

error message

==========

syntax error at FirstPerlScript.pl line 5, near "$driver:"
Unquoted string "database" may clash with future reserved word at FirstPerlScript.pl line 5.

FirstPerlScript.pl

=============

1: #!/usr/bin/perl -w

2: use DBI;

3: $database = "Meet_A_Geek";

4: $driver = "DBI:mysql";

5: my $dbh = DBI-> connect($driver:database=$database, "root", "tacobell") or die "Can't connect";

6: # Insert the values

7: $dbh->do("INSERT INTO Customers (First_Name, Last_Name) VALUES ('Renee', 'Robertson')");

8: $dbh->do("INSERT INTO Customers (First_Name, Last_Name) VALUES ('Larry', 'Isacson')");

9: $dbh->do("INSERT INTO Customers (First_Name, Last_Name) VALUES ('Mark', 'Harrison')");

10: # Disconnect from the database

11: $dbh->disconnect;

12: exit;




---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
--0-1861339067-1032478659=:71794--