my $Q = CGI->new(); my $DBH = DBI->connect( ) or die 'Error connecting: ' . DBI->errstr; $Q = get_member( $Q, $DBH ); sub get_member { my $q = shift; my $dbh = shift; my $sth = $dbh->prepare( ); # here's the error }