That's no DBI issue. You have to declare the variable $dbh using my, local or our before using it. Example:
my $dbh = DBI->connect(... Alternatively you could omit "-w", "use warnings" and "use strict" to make your script run without special variable declarations. Hendrik Am Mi, 9.06.2010, 00:13, schrieb r...@gandalf.ws: > I am running Ubuntu 10.04 LTS and perl, v5.10.1. > > I am attempting to test perl access to a mysql database with the following > code: > > #!/usr/bin/perl -w > > use strict; > use warnings; > use DBI; > > my($USAGE) = "$0 DUMMY\n\n"; > > unless(@ARGV) { die $USAGE; } > > $dbh = DBI->connect('DBI:mysql:friends', 'rich', 'MarySue' > ) || die "Could not connect to > database: $DBI::errstr"; > # (insert querys here...) > $dbh->disconnect(); > > When executed the program produces the following results: > > r...@rich-desktop:~/Documents/perl/friends$ ./email01.pl > Global symbol "$dbh" requires explicit package name at ./email01.pl line > 23. > Global symbol "$dbh" requires explicit package name at ./email01.pl line > 26. > Execution of ./email01.pl aborted due to compilation errors. > r...@rich-desktop:~/Documents/perl/friends$ > > What am I doing wrong? > > > Rich Price r...@gandalf.ws > -------------------------------------------- > The optimist thinks that this is the best of > all possible worlds. The pessimist knows it. > J. Robert Oppenheimer > >