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--

RE: Problem with executing FirtPerlScript.pl

am 20.09.2002 01:53:46 von charles.zhao

I think what you really should be doing is something like:
5: my $dbh = DBI-> connect("$driver:$database", "root", "tacobell",
{RaiseError=>1, AutoCommit=>0}) or die "Can't connect";

-----Original Message-----
From: j zhao [mailto:jinhuaz_us@yahoo.com]
Sent: Thursday, September 19, 2002 4:38 PM
To: msql-mysql-modules@lists.mysql.com
Subject: Problem with executing FirtPerlScript.pl



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

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1920@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

RE: Problem with executing FirtPerlScript.pl

am 20.09.2002 01:53:46 von charles.zhao

I think what you really should be doing is something like:
5: my $dbh = DBI-> connect("$driver:$database", "root", "tacobell",
{RaiseError=>1, AutoCommit=>0}) or die "Can't connect";

-----Original Message-----
From: j zhao [mailto:jinhuaz_us@yahoo.com]
Sent: Thursday, September 19, 2002 4:38 PM
To: msql-mysql-modules@lists.mysql.com
Subject: Problem with executing FirtPerlScript.pl



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

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1920@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: Problem with executing FirtPerlScript.pl

am 20.09.2002 07:26:27 von Garry Williams

On Thu, Sep 19, 2002 at 04:37:39PM -0700, j zhao wrote:

> 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.


Strings must be quoted in Perl[1]. Since you didn't quote the first
parameter to the connect() method, the Perl compiler tried to parse it
as Perl code and failed.


> 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;

Try this instead:

[untested]

#!/usr/bin/perl -w
use strict;
use DBI;

my $dsn = 'dbi:mysql:Meet_A_Geek';
my $dbh = DBI->connect($dsn, 'root',
'tacobell', { RaiseError => 1,
PrintError => 1 });

my $sth = $dbh->prepare(q{INSERT INTO Customers
(First_Name, Last_Name)
VALUES (?, ?) });

$sth->execute('Renee', 'Robertson');
$sth->execute('Larry', 'Isacson');
$sth->execute('Mark', 'Harrison');

$sth->finish();
$dbh->disconnect();

Always develop Perl programs with warnings enabled and use strict.
(You had warnings turned on but didn't enable strictures.)

Read the DBI manual page (perldoc DBI) to find out why I turned on
RaiseError and PrintError in the DBI::connect() call.

Read the DBI manual page to learn why you should prepare statements
with place holders and bind values to them using the execute() method.

Actually, the DBI manual page is one of the best manual pages I've
seen. It will prove very useful over and over again.

Hope this helps.

[1] The "fat comma" operator, => will automatically quote bare words
on its left. Bare words inside curlies in a hash element will be
automatically quoted. Without use strict, Perl will try to interpret
bare words as strings[2]. This will lead to the warning you received,
if the bare word is all lower-case. The un-quoted string in your
program was _not_ a bare word.

[2] Unless Perl can interpret the bare word as an operator or function
call.[3]

[3] I don't think I've ever footnoted a footnote before.

--
Garry Williams, Zvolve Systems, Inc., +1 770 551-4504

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1921@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: Problem with executing FirtPerlScript.pl

am 20.09.2002 07:26:27 von Garry Williams

On Thu, Sep 19, 2002 at 04:37:39PM -0700, j zhao wrote:

> 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.


Strings must be quoted in Perl[1]. Since you didn't quote the first
parameter to the connect() method, the Perl compiler tried to parse it
as Perl code and failed.


> 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;

Try this instead:

[untested]

#!/usr/bin/perl -w
use strict;
use DBI;

my $dsn = 'dbi:mysql:Meet_A_Geek';
my $dbh = DBI->connect($dsn, 'root',
'tacobell', { RaiseError => 1,
PrintError => 1 });

my $sth = $dbh->prepare(q{INSERT INTO Customers
(First_Name, Last_Name)
VALUES (?, ?) });

$sth->execute('Renee', 'Robertson');
$sth->execute('Larry', 'Isacson');
$sth->execute('Mark', 'Harrison');

$sth->finish();
$dbh->disconnect();

Always develop Perl programs with warnings enabled and use strict.
(You had warnings turned on but didn't enable strictures.)

Read the DBI manual page (perldoc DBI) to find out why I turned on
RaiseError and PrintError in the DBI::connect() call.

Read the DBI manual page to learn why you should prepare statements
with place holders and bind values to them using the execute() method.

Actually, the DBI manual page is one of the best manual pages I've
seen. It will prove very useful over and over again.

Hope this helps.

[1] The "fat comma" operator, => will automatically quote bare words
on its left. Bare words inside curlies in a hash element will be
automatically quoted. Without use strict, Perl will try to interpret
bare words as strings[2]. This will lead to the warning you received,
if the bare word is all lower-case. The un-quoted string in your
program was _not_ a bare word.

[2] Unless Perl can interpret the bare word as an operator or function
call.[3]

[3] I don't think I've ever footnoted a footnote before.

--
Garry Williams, Zvolve Systems, Inc., +1 770 551-4504

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1921@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: Problem with executing FirtPerlScript.pl

am 20.09.2002 12:02:39 von Greg Meckes

Actually, it's simply a space for one: DBI->connect

Should be: DBI->connect

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



> 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


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1922@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: Problem with executing FirtPerlScript.pl

am 20.09.2002 12:02:39 von Greg Meckes

Actually, it's simply a space for one: DBI->connect

Should be: DBI->connect

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



> 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


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1922@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

RE: Problem with executing FirtPerlScript.pl

am 20.09.2002 16:27:34 von Greg Meckes

Actually, it's simply a space for the first thing: DBI->connect

Should be: DBI->connect

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

> 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
>
> ------------------------------------------------------------ ---------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail msql-mysql-modules-thread1920@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
>


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1923@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

RE: Problem with executing FirtPerlScript.pl

am 20.09.2002 16:27:34 von Greg Meckes

Actually, it's simply a space for the first thing: DBI->connect

Should be: DBI->connect

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

> 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
>
> ------------------------------------------------------------ ---------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail msql-mysql-modules-thread1920@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.
>


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1923@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: Problem with executing FirtPerlScript.pl

am 21.09.2002 21:23:42 von Garry Williams

On Fri, Sep 20, 2002 at 07:27:34AM -0700, Greg Meckes wrote:
> > 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";
>
> Actually, it's simply a space for the first thing: DBI->connect


Actually, that has nothing to do with the original poster's problem.
Perl's syntax allows a space both before and after the arrow operator.


> Should be: DBI->connect
>
> Second, try this syntax:
> my $dbh = DBI->connect($driver:$database, "root", "tacobell") or die
> "Can't connect";


That is wrong, too. You must quote strings in Perl.

DBI -> connect( "$driver:$database", ...

--
Garry Williams, Zvolve Systems, Inc., +1 770 551-4504

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1924@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.

Re: Problem with executing FirtPerlScript.pl

am 21.09.2002 21:23:42 von Garry Williams

On Fri, Sep 20, 2002 at 07:27:34AM -0700, Greg Meckes wrote:
> > 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";
>
> Actually, it's simply a space for the first thing: DBI->connect


Actually, that has nothing to do with the original poster's problem.
Perl's syntax allows a space both before and after the arrow operator.


> Should be: DBI->connect
>
> Second, try this syntax:
> my $dbh = DBI->connect($driver:$database, "root", "tacobell") or die
> "Can't connect";


That is wrong, too. You must quote strings in Perl.

DBI -> connect( "$driver:$database", ...

--
Garry Williams, Zvolve Systems, Inc., +1 770 551-4504

------------------------------------------------------------ ---------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail msql-mysql-modules-thread1924@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail msql-mysql-modules-unsubscribe@lists.mysql.com instead.