On Mon, 5 Aug 2002, Nate wrote:
=>I recently used the ppm feature on my activeperl (Win32) to install both
the DBI package and the DBD-mysql modules. looking through the
documentation this seems to be all i need to do to access MySQL through
perl. However When i try to run my script i get an error that says the
following:
=>
=>Global symbol "$dbh" requires explicit package name at dbi.pl
=>
=>the entire script reads as follows:
=>
=>#!c:/perl/bin/perl.exeuse strict;use DBI;$dbh =
DBI->connect("DBI:mysql:database=mvc2;host=localhost",
"", "", {RaiseError => 1});$dbh->do("CREATE TABLE foo (id INTEGER, name
VARCHAR(20)");
=>
=>What is the problem? How do i resolve it?
=>
Nate,
Try 'my $dbh' after 'use DBI;' -- The 'use strict' pragma requires lexical
scoping of all variables.
- Dwalu
.peace