#!/usr/software/bin/perl5.8.8 use strict; use warnings; my $db = 'somedb'; my $dbh = DBI->connect("dbi:SQLite:dbname=$db", "", "", {RaiseError => 1}) or die $DBI::errstr; # doing something here with $dbh... $dbh->disconnect; #### #!/usr/software/bin/perl5.8.8 use strict; use warnings; my $db = 'somedb'; my $dbh = DBI->connect("dbi:SQLite:dbname=$db", "", "", {RaiseError => 1}); # Is this the right way to check if DBI connected to the database? unless ($dbh) { print "Unable to connect to $db.\n"; # doing something else here... } # doing something here with $dbh... $dbh->disconnect;