sub do_something() { if($dbh's status is false) { $dbh=DBI->connect().... } }