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

Reply via email to