first, you have to get rid of the use DBI; inside the if() statement -- that is being run at compile time (see use). For (attempting) loading at runtime, see require. Also I think your $@ logic is backwards (see eval)... Try something like this:
eval "require DBI";
my $dbi_ok = $@ ? 0 : 1;
if( $dbi_ok ){
# do DBI stuff here
}else{
print "NO DBI\n";
}